Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript support? #110

Open
ernestdodz opened this issue Aug 4, 2022 · 4 comments
Open

Typescript support? #110

ernestdodz opened this issue Aug 4, 2022 · 4 comments

Comments

@ernestdodz
Copy link

image
I wanna try but got this problem.
'Image' cannot be used as a JSX component. Its instance type 'SuspenseImage' is not a valid JSX element. The types returned by 'render()' are incompatible between these types. Type '{} | null | undefined' is not assignable to type 'ReactNode'. Type '{}' is not assignable to type 'ReactNode'.

I am using latest react with nextjs.

@ernestdodz
Copy link
Author

I think this is issue with react 18, as the plugin is not updated yet.

@gokcan
Copy link
Owner

gokcan commented Apr 10, 2023

Hi, which version of React is this example from? Do you have a specific example with CodeSandbox/Replit etc link?

@babyfish-ct
Copy link

Same problem under react-17.0.2

Its type 'typeof SuspenseImage' is not a valid JSX element type

@babyfish-ct
Copy link

Now, I'm using the workaround

const ImageForTs = Image as any as React.ComponentClass<ImageProps>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants