question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript errors on fresh install

See original GitHub issue

Intended outcome:

Installing should not produce any errors in typescript.

Actual outcome:

Typescript produced the following errors, immediately after installing apollo-client:

node_modules/@types/isomorphic-fetch/index.d.ts(8,30): error TS2304: Cannot find name 'fetch'.
node_modules/apollo-client/transport/afterware.d.ts(4,15): error TS2304: Cannot find name 'Response'.
node_modules/apollo-client/transport/afterware.d.ts(5,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/afterware.d.ts(11,16): error TS2304: Cannot find name 'Response'.
node_modules/apollo-client/transport/afterware.d.ts(12,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/batchedNetworkInterface.d.ts(8,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/batchedNetworkInterface.d.ts(11,16): error TS2304: Cannot find name 'Response'.
node_modules/apollo-client/transport/batchedNetworkInterface.d.ts(12,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/batchedNetworkInterface.d.ts(18,64): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/batchedNetworkInterface.d.ts(30,12): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/middleware.d.ts(5,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/middleware.d.ts(12,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/networkInterface.d.ts(31,12): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/networkInterface.d.ts(39,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/networkInterface.d.ts(42,15): error TS2304: Cannot find name 'Response'.
node_modules/apollo-client/transport/networkInterface.d.ts(43,14): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/networkInterface.d.ts(50,12): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/networkInterface.d.ts(51,49): error TS2304: Cannot find name 'RequestInit'.
node_modules/apollo-client/transport/networkInterface.d.ts(59,77): error TS2304: Cannot find name 'Response'.
node_modules/apollo-client/transport/networkInterface.d.ts(66,12): error TS2304: Cannot find name 'RequestInit'.

How to reproduce the issue:

  1. Clone: https://github.com/ForbesLindesay/apollo-client-typescript-error
  2. Run npm run build
  3. Observe that there are typescript errors, and that they’re all from apollo.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
kamilkisielacommented, Jun 20, 2017

You have two options:

a) add dom to tsconfig.json > compilerOptions.lib b) install typings that contains fetch, Response and RequestInit

First option is recommended 👍

@helfer Just so you know about it, this could be a popular topic in github issues 😃

0reactions
stale[bot]commented, Aug 24, 2017

This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Apollo Client!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript Errors after install - Microsoft Community Hub
Hello, I cannot practice TypeScript because I get these errors every time when I run a ts file: I have latest VS Code...
Read more >
Why and how VSCode fresh install thinks it has TypeScript?
VS Code ships with a recent stable version of the TypeScript language service and it may not match the version of TypeScript installed...
Read more >
TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >
TS Playground - An online editor for exploring TypeScript and ...
Check for class properties that are declared but not set in the constructor. ... Enable error reporting when this is given the type...
Read more >
[VS 2022] Javascript Content Files Project errors when using ...
Run dotnet new angular · Run npx @angular/cli@13 update @angular/core@13 @angular/cli@13 to update to angular 13 and typescript 4.4.4 · Notice errors from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found