Apollo-client: Update @types/isomorphic-fetch optional dependency for typescript 2.2

Created on 23 Feb 2017  ยท  12Comments  ยท  Source: apollographql/apollo-client

In typescript 2.2 fetch definitions are now included in the dom lib. In apollo-client, there is a dependency on an older version of @types/isomorphic-fetch and that is causing duplicate type definition errors. Updating that dependency should fix the issue.

Most helpful comment

Having same problem with typescript 2.2.1 and @types/graphql.

$ tsc -v
Version 2.2.1

/Users/tomasvykruta/Documents/playground/pollo_starter/apolloclient
โ”œโ”€โ”€ @types/[email protected]
โ””โ”€โ”ฌ [email protected]
โ”œโ”€โ”€ @types/[email protected]
โ”œโ”€โ”€ @types/[email protected] deduped
โ””โ”€โ”€ @types/[email protected]

Many errors due to conflict (showing only few here)

$ tsc
node_modules/@types/isomorphic-fetch/index.d.ts(23,14): error TS2300: Duplicate identifier 'BodyInit'.
node_modules/@types/isomorphic-fetch/index.d.ts(24,14): error TS2300: Duplicate identifier 'RequestInfo'.

All 12 comments

Will removing it break things for people using typescript older than 2.2?

It should be backwards compatible: see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/14796

Ah! @davidye want to send a PR updating to the correct version?

@stubailo Hmm a simple version bump didn't work as there have been some changes between @types/isomorphic-fetch versions 0.0.30 => 0.0.33.

For example IResponse => Response in the latest version. And updating seems to cause conflicts with: https://github.com/apollographql/apollo-client/blob/c93b4cc56a9e30f8062a1d3501b7ee811f7a9edd/fetch-mock.typings.d.ts#L9

@davidye have you tried setting skipLibCheck? That should work around the lodash thing. The other things will have to be changed in the Apollo Client source code.

@helfer I just want to fix this specific issue since it's preventing us from upgrading typescript.

Updating apollo-client to typescript 2.2 is a separate issue which I didn't really dig into.

@davidye I see. In that case I'll try to make time to fix it over the weekend and release a new patch version for you.

@helfer it would be great to release a patch with the fix from @davidye soon as I struggled with this issue after updating all my dependencies ๐Ÿฅ‡

Fixed and released ๐Ÿ™‚

Having same problem with typescript 2.2.1 and @types/graphql.

$ tsc -v
Version 2.2.1

/Users/tomasvykruta/Documents/playground/pollo_starter/apolloclient
โ”œโ”€โ”€ @types/[email protected]
โ””โ”€โ”ฌ [email protected]
โ”œโ”€โ”€ @types/[email protected]
โ”œโ”€โ”€ @types/[email protected] deduped
โ””โ”€โ”€ @types/[email protected]

Many errors due to conflict (showing only few here)

$ tsc
node_modules/@types/isomorphic-fetch/index.d.ts(23,14): error TS2300: Duplicate identifier 'BodyInit'.
node_modules/@types/isomorphic-fetch/index.d.ts(24,14): error TS2300: Duplicate identifier 'RequestInfo'.

I am also running into the same issue as @lionhive. Did you find a fix/workaround by any chance?

I'm hitting this same problem. It's frustrating because my project was working fine before, but now there's this broken dependency. What is the right version of apollo-client that doesn't rely on the broken isomorphic-fetch 0.0.33, but that also does not force me to upgrade from React 15 to 16?

Was this page helpful?
0 / 5 - 0 ratings