Create a tsconfig.json tsc --init
Compile ts file into js file tsc FILENAME
Run in watch mode tsc --watch FILENAME
Use TypeScript with create-react-app
- if you want to creater a new directory
npx create-react-app PROJECT_NAME --template typscript
or
- if you want to initialize in a currency directory
npx create-react-app . --template typescript
Specify the output directory in the tsconfig.json
- In this project, I created a dist directory. I added the filepath to the tsconfig.json as well as the script in index.html