I'm having difficulties adding TypeScript to an already existing create-react-app application. Previously I've always added it before starting the project, simply by create-react-app my-app --scripts-version=react-scripts-ts
, but that doesn't work now.
The only "solution" I found here is:
- Create a temporary project with
react-scripts-ts
- Copy
tsconfig.json
,tsconfig.test.json
,tslint.json
from the temporary project src folder to your project'ssrc
folder. - In
package.json
, change all the references toreact-scripts
toreact-scripts-ts
in the scripts section.
This just seems like a weird workaround, and not very efficient. Does anyone know if it's possible to add it in a better way than this?