1yarn add --dev typescript @types/jest @types/react @types/react-native @types/react-test-renderer
2# or for npm
3npm install --save-dev typescript @types/jest @types/react @types/react-native @types/react-test-renderer
4
1module.exports = {
2 preset: 'react-native',
3 moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
4};
5
1npx --ignore-existing react-native init MyApp --template react-native-template-typescript
1Default comand is not working
2=====not working. ===) npx react-native init MyApp --template react-native-template-typescript
3
4
5==============Use this command to install typescript==================
6
7====) npx --ignore-existing react-native init MyApp --template react-native-template-typescript
1{
2 "compilerOptions": {
3 "allowJs": true,
4 "allowSyntheticDefaultImports": true,
5 "esModuleInterop": true,
6 "isolatedModules": true,
7 "jsx": "react",
8 "lib": ["es6"],
9 "moduleResolution": "node",
10 "noEmit": true,
11 "strict": true,
12 "target": "esnext"
13 },
14 "exclude": [
15 "node_modules",
16 "babel.config.js",
17 "metro.config.js",
18 "jest.config.js"
19 ]
20}
21