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

Typescript error: cannot find module 'graphql-tag/printer' #4

Closed
swarthout opened this issue Jul 6, 2016 · 4 comments
Closed

Typescript error: cannot find module 'graphql-tag/printer' #4

swarthout opened this issue Jul 6, 2016 · 4 comments

Comments

@swarthout
Copy link

swarthout commented Jul 6, 2016

I am building an angular2 app and I am getting the following errors when I build:

TypeScript error: /Users/scott/Documents/showcase/client/node_modules/apollo-client/index.d.ts(3,23): Error TS2307: Cannot find module 'graphql-tag/printer'.
TypeScript error: /Users/scott/Documents/showcase/client/node_modules/apollo-client/middleware.d.ts(4,14): Error TS2304: Cannot find name 'RequestInit'.
TypeScript error: /Users/scott/Documents/showcase/client/node_modules/apollo-client/networkInterface.d.ts(25,12): Error TS2304: Cannot find name 'RequestInit'.
TypeScript error: /Users/scott/Documents/showcase/client/node_modules/apollo-client/networkInterface.d.ts(31,14): Error TS2304: Cannot find name 'RequestInit'.
TypeScript error: /Users/scott/Documents/showcase/client/node_modules/apollo-client/networkInterface.d.ts(35,68): Error TS2304: Cannot find name 'RequestInit'.

Does anyone have any suggestions? Should I just downgrade graphql-tag until typescript support is better?

@swarthout
Copy link
Author

I tried doing import { print } from 'graphql-tag/printer'; before I imported from apollo-client, but typescript wouldn't recognize the package

@kamilkisiela
Copy link
Contributor

kamilkisiela commented Jul 6, 2016

@swarthout As I mentioned before at apollostack/angular2-apollo slack channel, to fix RequestInit you should install typings for whatwg-fetch or isomorphic-fetch or fetch polyfill you use :)

@swarthout
Copy link
Author

swarthout commented Jul 6, 2016

@kamilkisiela This is what I am getting when I try to install whatwg-fetch typings:

➜  client git:(master) ✗ typings search whatwg
Viewing 1 of 1

NAME         SOURCE HOMEPAGE                        DESCRIPTION VERSIONS UPDATED                 
whatwg-fetch dt     https://github.com/github/fetch             1        2016-05-24T14:20:46.000Z


➜  client git:(master) ✗ typings install whatwg-fetch
typings ERR! message Unable to find "whatwg-fetch" ("npm") in the registry. Did you want to try searching another source?Also, if you want contribute these typings, please help us: https://github.com/typings/registry
typings ERR! caused by https://api.typings.org/entries/npm/whatwg-fetch/versions/latest responded with 404, expected it to equal 200

typings ERR! cwd /Users/scott/Documents/showcase/client
typings ERR! system Darwin 15.2.0
typings ERR! command "/Users/scott/.nvm/versions/node/v6.0.0/bin/node" "/usr/local/bin/typings" "install" "whatwg-fetch"
typings ERR! node -v v6.0.0
typings ERR! typings -v 0.8.1

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>

@kamilkisiela
Copy link
Contributor

@swarthout You can use isomorphic-fetch

kamilkisiela pushed a commit to kamilkisiela/graphql-tag that referenced this issue Jul 6, 2016
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

No branches or pull requests

2 participants