-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TS2605 error when importing react class components from legacy jsx files. #14881
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
Should be fixed by #14832 |
I am still seeing this issue when using ES6 I have also tried adding Current workaround is to tsconfig.json {
"compilerOptions": {
"baseUrl": ".",
"module": "commonjs",
"outDir": "./public/dist/build/",
"target": "es5",
"lib": ["dom", "es2015"],
"jsx": "react",
"allowJs": true,
"pretty": true,
"downlevelIteration": true,
"experimentalDecorators": true,
"sourceMap": true
},
"exclude": [
"node_modules"
],
"include": [
"**/*.js",
"**/*.jsx",
"**/*.ts",
"**/*.tsx"
]
}
|
@alecmerdler i am unable to reproduce this locally. please log a new issue and give us some more context. |
Okay, I have created a new issue and repo #18134. |
FWIW, I was also experiencing this issue with legacy JSX files. However changing this:
to:
fixed the issue. ¯_(ツ)_/¯ |
In the context of migrating a react js app to typescript, we have a mix of legacy jsx files and tsx files.
When on a tsx file I import a component in a jsx file is a class extending React.Component, I get the following error:
TypeScript Version: 2.2.2
Code
legacy.jsx
client.tsx
tsconfig.json
alternatively, find this setup here: https://github.com/rdarder/ts-react-jsx-bug
Note that if instead of extending React.Component I do
export const Sample = React.CreateClass({...})
the project builds fine. I am not sure if this is an issue with @types/react instead
The text was updated successfully, but these errors were encountered: