THIS IS NOT AN ISSUE WITH create-react-app; The typings for @types/[email protected] are not released yet and need to address this issue. The WIP can be found here. I already created a note for this issue on the PR.
I actually don't know whether this is an issue with the type definitions for react or react-scripts.
When upgrading to TypeScript 4.1.x I will get the following error:
Could not find a declaration file for module 'react/jsx-runtime'. '.../node_modules/react/jsx-runtime.js' implicitly has an 'any' type.
If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react` TS7016
Adding the following to the react-app-env.d.ts resolved the issue, but feels hacky.
declare module "react/jsx-runtime" {
export default any;
}
Would appreciate any information on whether that is an issue that needs to be solved within create-react-app or something that needs to be addressed by the type definitions.
Here the tsconfig.json for reference:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
The behavior can be observed in this or build: https://github.com/n1ru4l/obs-character-info/pull/17
I鈥檓 getting this issue outside of CRA with Typescript 4.1.2
For reference:
It seems like this must be addressed in the @types/react package.
I noted this on the PR for updating @types/react for [email protected] over here: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/48971#pullrequestreview-535291028
Gonna close this as it is not an issue related to create-react-app.
This got now addressed in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/49701
Most helpful comment
I鈥檓 getting this issue outside of CRA with Typescript 4.1.2