Skip to content

Commit dc4d62d

Browse files
ortaiansu
authored andcommitted
Update adding-typescript.md (#7815)
1 parent c8ca307 commit dc4d62d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

docusaurus/docs/adding-typescript.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ title: Adding TypeScript
77
88
[TypeScript](https://www.typescriptlang.org/) is a typed superset of JavaScript that compiles to plain JavaScript.
99

10+
## Installation
11+
1012
To start a new Create React App project with [TypeScript](https://www.typescriptlang.org/), you can run:
1113

1214
```sh
@@ -33,16 +35,19 @@ Next, rename any file to be a TypeScript file (e.g. `src/index.js` to `src/index
3335

3436
Type errors will show up in the same console as the build one. You'll have to fix these type errors before you continue development or build your project. For advanced configuration, [see here](advanced-configuration.md).
3537

36-
To learn more about TypeScript, check out [its documentation](https://www.typescriptlang.org/).
38+
## Getting Started with TypeScript and React
39+
40+
You are not required to make a [`tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html), one will be made for you. You are allowed to edit the generated TypeScript configuration.
41+
42+
- [TypeScript Handbook](https://www.typescriptlang.org/)
43+
- [TypeScript Example on React](https://www.typescriptlang.org/play/index.html?jsx=2&esModuleInterop=true&e=196#example/typescript-with-react)
44+
- [React + TypeScript Cheatsheets](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet#reacttypescript-cheatsheets) has a good overview on how to use React with TypeScript
3745

38-
> **Note:** If your project is not created with TypeScript enabled, npx may be using a cached version of `create-react-app`.
39-
> Remove previously installed versions with `npm uninstall -g create-react-app` (see [#6119](https://github.com/facebook/create-react-app/issues/6119#issuecomment-451614035)).
46+
## Troubleshooting
4047

41-
> **Note:** You are not required to make a [`tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html), one will be made for you.
42-
> You are allowed to edit the generated TypeScript configuration.
48+
If your project is not created with TypeScript enabled, npx may be using a cached version of `create-react-app`. Remove previously installed versions with `npm uninstall -g create-react-app` (see [#6119](https://github.com/facebook/create-react-app/issues/6119#issuecomment-451614035)).
4349

44-
> **Note:** If you are currently using [create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript/), see [this blog post](https://vincenttunru.com/migrate-create-react-app-typescript-to-create-react-app/) for instructions on how to migrate to Create React App.
50+
If you are currently using [create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript/), see [this blog post](https://vincenttunru.com/migrate-create-react-app-typescript-to-create-react-app/) for instructions on how to migrate to Create React App.
4551

46-
> **Note:** We recommend using [VSCode](https://code.visualstudio.com/) for a better integrated experience.
4752

48-
> **Note:** Constant enums and namespaces are not supported.
53+
Constant enums and namespaces are not supported, you can learn about the constraints of [using Babel with TypeScript here](https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats).

0 commit comments

Comments
 (0)