Adding TypeScript to existing project does not add tsconfig
See original GitHub issueDescribe the bug
If you follow https://create-react-app.dev/docs/adding-typescript and attempt to add TypeScript to existing project using
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
The resulting changes will obviously not include tsconfig, unlike newly created projects and contrary to next section of manual.
Environment
create-react-app: 4.0.3
Steps to reproduce
npx create-react-app my-app
cd my-app
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
cat tsconfig.json
Expected behavior
Default tsconfig.json file is added to the project if you follow documentation.
Actual behavior
No tsconfig.json 😦
Issue Analytics
- State:
- Created 2 years ago
- Reactions:19
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Adding TypeScript to existing create-react-app app
Create a temporary project with react-scripts-ts · Copy tsconfig.json , tsconfig.test.json , tslint. · In package.json , change all the references ...
Read more >Adding typescript to the existing react project
This note will help you understand how to add typescript to an existing Create React App project and start writing new files in...
Read more >Adding TypeScript | Create React App
To add TypeScript to an existing Create React App project, ... You are not required to make a tsconfig.json file, one will be...
Read more >Use Typescript in an already existing create-react-app Project
Adding Typescript to your Javascript code · Change a javascript extension file .js to a typescript extension .ts or if the file extension...
Read more >How to set up TypeScript
Add TypeScript to your project, or install TypeScript globally. ... For project types which don't support Nuget, you can use the TypeScript Visual...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m also seeing this problem when trying to add TS to an existing app
As a workaround, I created a new react app by running:
npx create-react-app ts-example --template typescript
And then copy-pasted the contents of the generated tsconfig.json into my existing app.I have the same problem used to create a new app:
Renamed files to
.tsx
and.ts
runnpm start
and scripts don’t seem to detect that I’m trying to use TS because no tsconfig.json is created. Have to create it manually to make it works.Node: v16.13.0 NPM: 8.3.2 System: MacOS