Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Sample React Native project with typescript has lots of type errors

$
0
0

I followed the docs to generate a sample project.

npx react-native init MyApp --template react-native-template-typescript

Then I started the project and run

tsc

I got 183 errors, seems that all of them are from the node_modules

3237             use: React.SVGProps<SVGUseElement>;                 ~~~  node_modules/@types/react/index.d.ts:3234:13    3234             use: React.SVGProps<SVGUseElement>;                     ~~~'use' was also declared here.node_modules/@types/react-test-renderer/node_modules/@types/react/index.d.ts:3238:13 - error TS2717: Subsequent property declarations must have the same type.  Property 'view' must be of type 'SVGProps<SVGViewElement>', but here has type 'SVGProps<SVGViewElement>'.3238             view: React.SVGProps<SVGViewElement>;                 ~~~~  node_modules/@types/react/index.d.ts:3235:13    3235             view: React.SVGProps<SVGViewElement>;                     ~~~~'view' was also declared here.node_modules/@types/react/index.d.ts:3047:14 - error TS2300: Duplicate identifier 'LibraryManagedAttributes'.3047         type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>                  ~~~~~~~~~~~~~~~~~~~~~~~~  node_modules/@types/react-test-renderer/node_modules/@types/react/index.d.ts:3048:14    3048         type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>                      ~~~~~~~~~~~~~~~~~~~~~~~~'LibraryManagedAttributes' was also declared here.Found 183 errors.

The current solution that I have is not perfect. I added this line

"skipLibCheck": true 

to the tsconfig file, but the complier with ignore all .d.ts file outside the node_modules.

Could anyone come up with a better solution?

Thanks a lot!


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>