RN v0.57 Supports TypeScript! This is sample project.
$ git clone git@github.com:Nkzn/ReactNative057Sample.git
$ cd ReactNative057Sample
$ npm install
or
$ yarn
# if you don't have cli: npm install -g react-native-cli
$ react-native run-ios
or
$ react-native run-android
$ npm run tsc
react-native init RN057Sample --version 0.57.0-rc.3
696d0535- rename
App.js
=>App.tsx
and few rewrites. 22ebea7a- This is works!
- Add
@types
modules & TypeScript Compiler 1464655d - Setup tsconfig.json for React Native (as below) 2d3922b9
- That's all! 🍺
{
"compilerOptions": {
// from https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/
"target": "esnext",
"moduleResolution": "node",
"allowJs": true,
"noEmit": true,
"strict": true,
"isolatedModules": true,
"esModuleInterop": true,
// additional
"allowSyntheticDefaultImports": true,
"jsx": "react",
"lib": ["esnext"]
},
"include": [
"src"
]
}