xxxxxxxxxx
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
# or
yarn add typescript @types/node @types/react @types/react-dom @types/jest
xxxxxxxxxx
npx create-react-app app-name --template typescript
# or using yarn
yarn create react-app app-name --template typescript
xxxxxxxxxx
npx create-react-app my-app --template typescript
/*if done correctly, many of your files should now have extension .tsx instead*/
xxxxxxxxxx
npm install --save-dev typescript @types/node @types/react @types/react-dom @types/jest
xxxxxxxxxx
npx create-react-app app-name --template typescript
# or using yarn
yarn create-react-app app-name --template typescript
xxxxxxxxxx
yarn add typescript @types/node @types/react @types/react-dom @types/jest --dev
#...then rename your .js files to .tsx
xxxxxxxxxx
npx create-react-app app-name --template typescript
// or using yarn
yarn create react-app app-name --template typescript
xxxxxxxxxx
yarn add typescript @types/node @types/react @types/react-dom @types/jest
xxxxxxxxxx
{
"compilerOptions": {
"jsx": "react",
"module": "commonjs",
"target": "es5",
"lib": ["es6", "dom"],
"strict": true,
"esModuleInterop": true
}
}