How to create react typescript application with Create React App

The easiest way to create a new app with TypeScript using Create React App is to run this command in a console:

Or if you use yarn:

Where npx is a package runner that comes with npm 5.2+ and higher. It executes packages like create-react-app or eslint and such.

create-react-app is a standard project creator from Create React App. It is used as the template for creating applications. It provides all the necessary dependencies and boilerplate code for a quick start.

And --template typescript is a setting which tells CRA to set up a new application using TypeScript. It will create .d.ts file and will set up tsconfig.json.

Now you can start the development server and see the result.

Console output

Sources#