apollo-client: RequestInit is not defined in typescript typings
Thanks for this amazing project! Loving it! A small detail:
When using apollo-client in typescript the RequestInit
is not defined.
It also references the graphql library which typings is not a part of the project.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 26 (12 by maintainers)
Why close this, I’m facing this problem and I don’t want to include dom lib to my server project
Here is my solution:
Closing this, since it’s quite dated and seems to have been solved.
RequestInit
is defined in fetch (isomorphic-fetch):@patriknil90 You should install
isomorphic-fetch
as one of npm dependencies to add the polyfill.Then install typings as follows:
To resolve missing
RequestInit
andIResponse
you should run:To fill the gap with
NodeJS
:@stubailo I noticed that
IResponse
is specific to isomorphic-fetch, typings ofwhatwg-fetch
doesn’t include it.It all depends on the ambient declaration:
Foo
is accessible globalyBar
you have to import from “graphql”