question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use namespace 'FrameContextProps' as a type.

See original GitHub issue

Typescript throws error when using FrameContextProps or FrameComponentProps. Please check example: https://codesandbox.io/s/goofy-paper-xesyu?file=/src/App.tsx

Screenshot 2021-12-06 at 12 54 05

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexandretrichotcommented, Dec 7, 2021

Hello, Same cause of problem for me. I used to use @types/react-frame-component (which works fine) but the latest version broke this behavior due to including index.ts in the package.

I don’t really understand this choice, if anyone has an idea…

The workaround I use is to declare the types of the module in my project to override the official declare module 'react-frame-component';.

declare module 'react-frame-component' {
  import * as React from 'react';

  export interface FrameComponentProps extends React.IframeHTMLAttributes<HTMLIFrameElement> {
    head?: React.ReactNode | undefined;
    mountTarget?: string | undefined;
    initialContent?: string | undefined;
    contentDidMount?: (() => void) | undefined;
    contentDidUpdate?: (() => void) | undefined;
    children: React.ReactNode;
  }

  export default class FrameComponent extends React.Component<FrameComponentProps> { }

  export interface FrameContextProps {
    document?: HTMLDocument;
    window?: Window;
  }

  export const FrameContext: React.Context<FrameContextProps>;

  export const FrameContextProvider: React.Provider<FrameContextProps>;

  export const FrameContextConsumer: React.Consumer<FrameContextProps>;

  export function useFrame(): FrameContextProps;
}

Good day !

0reactions
seleckiscommented, May 16, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Warning: Accessing PropTypes via the main React package is ...
... Style import are not included HOT 4; Cannot use namespace 'FrameContextProps' as a type. HOT 5; `createPortal` cannot have a nullable target...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found