You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/adding-typescript.md
+12-8Lines changed: 12 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,22 @@ id: adding-typescript
3
3
title: Adding TypeScript
4
4
---
5
5
6
-
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
6
+
[TypeScript](https://www.typescriptlang.org/) is a typed superset of JavaScript that compiles to plain JavaScript.
7
7
8
-
Recent versions of [TypeScript](https://www.typescriptlang.org/)work with Create React App projects out of the box thanks to Babel 7. Note that Babel 7 TypeScript does not allow some features of TypeScript such as constant enum and namespaces.
8
+
To add [TypeScript](https://www.typescriptlang.org/)to a Create React App project, first install it:
9
9
10
-
To add TypeScript to a Create React App project, follow these steps:
2. Rename `src/index.js` to `src/index.tsx` or create an empty [`tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) at the root project directory.
14
-
3. Restart your development server (if applicable). This will set sensible defaults and the required values in your [`tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).
16
+
Next, rename any file to be a TypeScript file (e.g. `src/index.js` to `src/index.tsx`) and **restart your development server**!
15
17
16
18
Type errors will show up in the same console as the build one.
17
19
18
-
We recommend using [VSCode](https://code.visualstudio.com/) for a better integrated experience.
19
-
20
20
To learn more about TypeScript, check out [its documentation](https://www.typescriptlang.org/).
21
+
22
+
> Note: We recommend using [VSCode](https://code.visualstudio.com/) for a better integrated experience.
23
+
24
+
> Note: Constant enum and namespaces are not supported.
0 commit comments