Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use with React Native / Typescript #574

Closed
esamattis opened this issue Sep 3, 2018 · 6 comments · Fixed by #631
Closed

Cannot use with React Native / Typescript #574

esamattis opened this issue Sep 3, 2018 · 6 comments · Fixed by #631

Comments

@esamattis
Copy link

esamattis commented Sep 3, 2018

The apollo module brings in the @types/node module as a transitive dependency which is an issue with React Native typings (@types/react-native) because they have conflicting type definitions:

Cannot redeclare block-scoped variable 'console'.
Duplicate identifier 'require'.

DefinitelyTyped/DefinitelyTyped#16825

I know this is issue is with @types/react-native and/or @types/node but that's a long standing issue with no solution in sight so I'm wondering if it would be possible to get rid of the dependency from apollo's side.

The dependencies which brings it in are as follows:

[email protected]
└─┬ [email protected]
  ├─┬ @types/[email protected]
  │ └─┬ @types/[email protected]
  │   └── @types/[email protected]  deduped
  ├─┬ @types/[email protected]
  │ └── @types/[email protected]
  ├─┬ @types/[email protected]
  │ └── @types/[email protected]  deduped
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └── @types/[email protected]  deduped
@danilobuerger
Copy link
Contributor

There are actually a couple of "solutions" and it is possible to use with react-native and typescript (I am doing so). The best "solution" to date is: DefinitelyTyped/DefinitelyTyped#15960 (comment)

@alloy
Copy link
Contributor

alloy commented Sep 3, 2018

imo the best solution is for runtime dependencies to never depend on @types/* packages. These are dev only packages and using the right ones should be left to the dev.

@danilobuerger
Copy link
Contributor

@alloy
Copy link
Contributor

alloy commented Sep 3, 2018

How can that be then? Dev dependencies don’t get pulled in when adding a runtime dependency to your package, no? From @epeli’s illustration it does look like the apollo package is pulling all of these into their project.

@danilobuerger
Copy link
Contributor

My guess would be some weird lerna stuff.

@esamattis
Copy link
Author

esamattis commented Sep 3, 2018

Here's the package.json from my project's node_modules/apollo/package.json:

https://gist.github.com/epeli/907fa4eaefa0f63d7f418e8506d7f625

It does seem to have some extra deps on it?

I'm using yarn 1.7.0 if it matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants