Typescript is already installed and configured when generating a project with a javascript front.
-
Install typescript
yarn add --dev typescript
-
Install basic type definitions (pick what you need) which are not bundled with the dependencies on your project. All these types are referenced here
yarn add --dev
@types/cheerio
@types/enzyme
@types/history
@types/jest
@types/lodash
@types/node
@types/react
@types/react-dom
@types/react-intl
@types/react-redux
@types/react-router
@types/react-router-dom
@types/react-test-renderer
@types/styled-components
@types/superagent
@types/webpack-env
- Create basic Typescript config by copying tsconfig.json and tsconfig.paths.json
- The project uses ESLINT to lint TypeScript code. If you want more information about the configuration, visit the Linter and Editor Configuration page.
- A Typescript file with JSX needs to have a .tsx extension (contrary to javascript where it is not necessary)
- Otherwise the extension should be .ts