Update adding-typescript.md

This commit is contained in:
Dan Abramov
2019-01-03 15:38:20 +00:00
committed by GitHub
parent 4c7c3c5e28
commit c8c3e48abd

View File

@@ -10,17 +10,21 @@ title: Adding TypeScript
To start a new Create React App project with [TypeScript](https://www.typescriptlang.org/), you can run:
```bash
$ npx create-react-app my-app --typescript
$ # or
$ yarn create react-app my-app --typescript
npx create-react-app my-app --typescript
# or
yarn create react-app my-app --typescript
```
To add [TypeScript](https://www.typescriptlang.org/) to a Create React App project, first install it:
```bash
$ 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
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
```
Next, rename any file to be a TypeScript file (e.g. `src/index.js` to `src/index.tsx`) and **restart your development server**!