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.
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?
Most helpful comment
Having same problem with typescript 2.2.1 and @types/graphql.
Many errors due to conflict (showing only few here)