-
-
Notifications
You must be signed in to change notification settings - Fork 433
Error Importing ES6 Class Extending React.Component into TSX #614
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
Comments
Thanks for the detailed repro - we appreciate it. I've taken a look and can't see any obvious problems. That said I use tsx rather than jsx and I'm not too clear on what problems might present when using jsx combined with the react types. If you could investigate further that would be awesome. To be honest though, if you're using TypeScript I'd take to leap and move to using TSX instead of JSX 😄 |
You were able to run We are introducing TypeScript/TSX to an exising ES6/JSX React application. After scouring the TypeScript GitHub repo for issues similar to mine, I haven't found any solutions. What indicates that it is a problem with |
I didn't run the code, I spent 10 minutes or so reading the source and the config. It looks OK but as I say I haven't used JSX with ts-loader before; just TSX. I've a limited amount of time to look at issues - if you could spend some time on this I'd appreciate it. I can advise but probably not more. That said: how are you trying to ignore the diagnostics - I don't see that anywhere? |
The issue seems to be with |
Moved from: microsoft/TypeScript#18134
Encountering errors using
webpack
when importing ES6 classes that extendReact.Component
into TSX. Entry file isapp.jsx
.Compiler outputs working code, and current solution is adding
ignoreDiagnostics: [2605, 2607]
tots-loader
options in Webpack config.TypeScript Version: 2.4.2
ts-loader Version: 2.3.4
Code
https://github.com/alecmerdler/tsx-jsx
Expected behavior:
tsc
with no errorswebpack
with no errorsActual behavior:
tsc
: no errorswebpack
:error TS2605: JSX element type 'Hello' is not a constructor function for JSX elements. Property 'setState' is missing in type 'Hello'.
and
error TS2607: JSX element class does not support attributes because it does not have a 'props' property.
The text was updated successfully, but these errors were encountered: