Answer the question
In order to leave comments, you need to log in
Why does CRA have @types dependencies in dependencies and not devDependencies?
Good afternoon, created an app with:
npx create-react-app app --template typescript
and in package.json dependencies
:
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.5.0",
"@types/jest": "^26.0.18",
"@types/node": "^12.19.8",
"@types/react": "^16.14.2",
"@types/react-dom": "^16.9.10"
devDependencies
"jsx": "react-jsx"
Specify JSX code generation: 'preserve', 'react', 'react-jsx', 'react-jsxdev' or 'react-native'.
Requires TypeScript version 2.2 or later.
Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'.
Answer the question
In order to leave comments, you need to log in
1. Because it doesn't matter where the dependencies are, the react application will still be built by webpack and bundled
2. The error occurs because TypeScript VSCode does not use the new Babel functions, but CRA does.
To eliminate it, you need to select the typescript version from the workspace
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question