While attempting to integrate TypeScript into a React-Native Expo project, I encountered an error when renaming a file from abc.js
to abc.tsx
:
I have been following the instructions provided at:
- https://facebook.github.io/react-native/blog/2018/05/07/using-typescript-with-react-native
- https://medium.com/@rintoj/react-native-with-typescript-40355a90a5d7
Any advice on how to resolve this issue?
rn-cli.config.js
module.exports = {
getTransformModulePath() {
return require.resolve('react-native-typescript-transformer');
},
getSourceExts() {
return ['ts', 'tsx', 'js', 'jsx'];
}
}
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"jsx": "react",
"outDir": "./dist",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowSyntheticDefaultImports": true,
//"strict": true,
"skipLibCheck": true,
"declaration": true,
"noUnusedLocals": true
},
"exclude": [
"node_modules"
]
}