This post uses Microsoft's TypeScript-React-Native-Starter repo as a guide.
Once you've tried scaffolding out an ordinary React Native project, you'll be ready to start adding TypeScript. Let's go ahead and do that.
The next step is to add TypeScript to your project. The following commands will:
The tsconfig.json
file contains all the settings for the TypeScript compile.
The defaults created by the command above are mostly fine, but open the file and uncomment the following line:
The rn-cli.config.js
contains the settings for the React Native TypeScript Transformer.
Open it and add the following:
Example Button component use Typescript:
Example Text component use Typescript: