I am currently migrating my RN project to TypeScript. I have finished the majority of my JS code, and now when I run tsc
I get several hundred errors that all seem to be
error TS 2717: Subsequent property declarations must have the same type. Property
prop must be of the type TYPE,
but here has type TYPE
for example:
error TS2717: Subsequent property declarations must have the same type. Property
'view' must be of type 'SVGProps<SVGViewElement>',
but here has type 'SVGProps<SVGViewElement>'.
which is doubly confusing because the listed types are almost always identical.
I am able to run my app, I am still getting useful messages from tslint, and any errors specific to my code appear at the bottom of the list of compiler errors.
My tsconfig.json
is currently:
{
"compilerOptions": {
"allowJs": true,
"target": "es2018",
"outDir": "dist",
"module": "commonjs",
"sourceMap": true,
"lib": ["esnext", "es7", "dom", "es6"],
"jsx": "react-native",
"strict": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"types": ["react-native"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
I've tried various solutions, including setting types
to []
as per the TypeScript docs and setting exclude
to various forms of node_modules
such as ./node_modules
, node_modules/*
etc but none of these changes have had any effect.