Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Typescript: Duplicated identifier between React Native and ES6 Lib #17
Newly created project with the template doesn't compile successfully. Global type declaration of
Find below errors shown in the console of a
node_modules/@types/react-native/globals.d.ts:92:14 - error TS2300: Duplicate identifier 'RequestInfo'. 92 declare type RequestInfo = Request | string; ~~~~~~~~~~~ node_modules/@types/react-native/index.d.ts:8844:11 - error TS2451: Cannot redeclare block-scoped variable 'console'. 8844 const console: Console; ~~~~~~~ node_modules/@types/react-native/index.d.ts:8852:18 - error TS2717: Subsequent property declarations must have the same type. Property 'geolocation' must be of type 'Geolocation', but here has type 'GeolocationStatic'. 8852 readonly geolocation: Geolocation; ~~~~~~~~~~~ node_modules/@types/react-native/index.d.ts:8855:11 - error TS2451: Cannot redeclare block-scoped variable 'navigator'. 8855 const navigator: Navigator; ~~~~~~~~~ node_modules/typescript/lib/lib.es6.d.ts:21580:13 - error TS2451: Cannot redeclare block-scoped variable 'navigator'. 21580 declare var navigator: Navigator; ~~~~~~~~~ node_modules/typescript/lib/lib.es6.d.ts:21756:13 - error TS2451: Cannot redeclare block-scoped variable 'console'. 21756 declare var console: Console; ~~~~~~~ node_modules/typescript/lib/lib.es6.d.ts:21813:6 - error TS2300: Duplicate identifier 'RequestInfo'. 21813 type RequestInfo = Request | string;
Steps to reproduce
Hi @nicolashemonic and sorry for my delayed answer, I was on vacation last week.
Thank you for the well done issue report. I tested it locally and I could reproduce the issue. As you described, defining the ES6 base typings with the
I added this to the latest master branch. I will wait with the release for the next React Native version 0.56 which should be released very soon.
About the TypeScript output, I fully agree with you. I guess it's the
I did indeed
Sadly it seems it's not possible to enable error reporting in the
I'll keep an eye on this and as soon as there's a solution for it, I'll include it in this template.
Thanks for your help
I know, I should start writing release notes...
The React Native CLI will always use the latest available React Native version (which currently is 0.56) and then setup the template. So yes, when you create a new project with the init command (