- Creating a react application with stypescript support using the create react app CLI
- Comparing project output
we create by typing:
npx create-react-app appname --template typescript
Which creates the app configured with Ts
The ts config file contains the configuration of how ts can be used in the project
react Ts CLI options:
- create-next-app
- create-snowpack-app
- gatsby
To add Typscript to existing app, you need to install and configure it within the app :
yarn add typescript @types/react @types/react-dom @types/node
after sintallation you can update the
.js files to have .ts extention eg. App.js => App.ts
after that :
yarn start
Or npm whichever you prefer