From 6f2e26f21c4e0a03407258f24a7dac3f6facdf1f Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 3 Jan 2019 15:41:57 +0000 Subject: [PATCH] Rearrange TS section a bit --- content/docs/static-type-checking.md | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/content/docs/static-type-checking.md b/content/docs/static-type-checking.md index 2cfb7c68..b05a4b1a 100644 --- a/content/docs/static-type-checking.md +++ b/content/docs/static-type-checking.md @@ -170,6 +170,23 @@ To use TypeScript, you need to: Let's go over these in detail. +### Using TypeScript with Create React App + +Create React App supports TypeScript out of the box. + +To create a **new project** with TypeScript support, run: + +```bash +npx create-react-app my-app --typescript +``` + +You can also add it to an **existing Create React App project**, [as documented here](https://facebook.github.io/create-react-app/docs/adding-typescript). + +>Note: +> +>If you use Create React App, you can **skip the rest of this page**. It describes the manual setup which doesn't apply to Create React App users. + + ### Adding TypeScript to a Project It all begins with running one command in your terminal. @@ -287,18 +304,6 @@ declare module 'querystring' { } ``` -### Using TypeScript with Create React App - -Create React App supports TypeScript out of the box. You can use it like this: - -```bash -create-react-app my-app --typescript -``` - -If you have an existing project, [you can read the documentation](https://facebook.github.io/create-react-app/docs/adding-typescript) on adding TypeScript. - -You can also try [typescript-react-starter](https://github.com/Microsoft/TypeScript-React-Starter#typescript-react-starter). - You are now ready to code! We recommend to check out the following resources to learn more about TypeScript: * [TypeScript Documentation: Basic Types](https://www.typescriptlang.org/docs/handbook/basic-types.html)