Hi Apollo Team!
I've been working on integrating apollo-client into my react-native project using Typescript. I've noticed that apollo-client has a dependency on @types/node, which has a conflict with @types/react-native, specifically duplicate identifiers for global and require. Trying to build my project after installing apollo-client, tsc gives me the follow stack trace:
49 declare var global: NodeJS.Global;
~~~~~~
node_modules/@types/node/index.d.ts(49,13): error TS2451: Cannot redeclare block-scoped variable 'global'.
73 declare var require: NodeRequire;
~~~~~~~
node_modules/@types/node/index.d.ts(73,13): error TS2300: Duplicate identifier 'require'.
8293 const global: React.GlobalStatic;
~~~~~~
node_modules/@types/react-native/index.d.ts(8293,11): error TS2451: Cannot redeclare block-scoped variable 'global'.
8294 function require(name: string): any;
~~~~~~~
node_modules/@types/react-native/index.d.ts(8294,14): error TS2300: Duplicate identifier 'require'.
Is there any way to remove the dependency on @types/node to accommodate for react-native? Have you experienced this and/or identified a solid workaround?
I have also tried running npm uninstall @types/node post-install, only to find that the apollo-client is tightly coupled to @types/node
I'll keep looking for a solution in the meantime and would love any feedback and advice you can offer. Thanks!
@dstik that's annoying indeed, but I think we can fix it by moving @types/node to devDependencies. It looks like our whole typings need a little bit of cleaning up; see the discussion in #1062.
@dstik could you see if 0.7.3 fixes this? We鈥檝e made a couple changes to typings recently and may have fixed this inadvertently.
Looks like it's working great now without issues. Thank you so much @calebmer!!
@calebmer
This is still an issue for me. I am running react-native 0.54 and apollo-boost 0.1.2. It appears that apollo-link is requiring @types/node