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

VSCode/TypeScript: JSX element type 'Component<{}, {}>' is not a constructor function for JSX elements. #1671

Closed
IngwiePhoenix opened this issue Jun 3, 2019 · 5 comments
Labels

Comments

@IngwiePhoenix
Copy link

image

I am new to TypeScript and basically moved to it due to a much more stable support for decorators, some frameworks and since I am generally more into typed languages like C/C++.

So when I began to put together a basic example with 10.0.0-beta.2, I got the error seen in the screenshot above.

Is that something I need to worry about - or rather, something that I can do anything about? Thanks!

@ForsakenHarmony
Copy link
Member

I think that might be a conflict between react and preact types

@Silic0nS0ldier
Copy link

I've hit another type incompatibility issue myself.

src/app.tsx:6:2 - error TS2605: JSX element type 'PrimaryButton' is not a constructor function for JSX elements.
  Types of property 'componentDidCatch' are incompatible.
    Type '(error: Error, errorInfo: ErrorInfo) => void' is not assignable to type '(error: any) => void'.

6  <PrimaryButton>I am a button.</PrimaryButton>

Would it be at all possible to expand the preact type definitions to use the existing widely used definitions distributed via @types/react?

@pmkroeker
Copy link
Contributor

pmkroeker commented Jun 15, 2019

Both of these problems should be resolved with #1703

@KashubaK
Copy link

Running into this problem on 10.0.0-rc.0. I have a typescript project that requires me to render preact components inside a react project, and whenever I do this I get the same error as OP.

@JoviDeCroock
Copy link
Member

Closing thanks to #1703 and a docs update about Preact/React typings. In case anyone runs into issues, re-open an issue with a reproduction please.

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

No branches or pull requests

6 participants