Create React App
For additional details, please refer to the Create React App documentation.
Create a New App with TypeScript
Using NPM
npx create-react-app your-app-name --typescript
or
Using Yarn
yarn create react-app your-app-name --typescript
Add TypeScript to an Existing Create React App Application
Using NPM
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
or
Using Yarn
yarn add typescript @types/node @types/react @types/react-dom @types/jest
After installing these (and any other types you may need), rename your .js
files to .tsx
and restart your development server.
This video runs through the instructions on this page.