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

ExecutionResult of graphql v15 not compatible with apollo-client types #6125

Closed
patricknick opened this issue Apr 8, 2020 · 4 comments
Closed
Milestone

Comments

@patricknick
Copy link

patricknick commented Apr 8, 2020

Intended outcome:
When for example defining an update function on useMutation, the parameter mutationResult is defined as FetchResult<T>. I expect therefore to receive a type of FetchResult<MyType>.

Actual outcome:

mutationResult is any
image

This is due to some changes in graphql v15, where they removed the generic type from ExecutionResult.
graphql/graphql-js#2490

How to reproduce the issue:

import { MutationUpdaterFn } from 'apollo-client';
const test: MutationUpdaterFn<{ test: string }> = (proxy, result) => {};

Versions

"apollo": "2.26.0",
"apollo-cache-inmemory": "^1.6.3",
"apollo-client": "^2.6.4",
"apollo-link": "^1.2.13",
"graphql": "^15.0.0",

System:
OS: macOS 10.15.4
Binaries:
Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
Yarn: 1.22.4 - ~/Development/akb-kupa-arbeitsplatz/node_modules/.bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
Browsers:
Chrome: 80.0.3987.163
Firefox: 74.0
Safari: 13.1

@simlu
Copy link

simlu commented Apr 15, 2020

Looks like the peerDependencies state that these are not compatible:
https://github.com/apollographql/apollo-client/blob/master/package.json#L58

So this is basically a request to support graphql 15

@patricknick
Copy link
Author

then this is related to #6111

@benjamn benjamn added this to the Release 3.0 milestone May 5, 2020
benjamn added a commit that referenced this issue May 5, 2020
Instead of using the ExecutionResult type from the graphql package,
we can use our own FetchResult<T> type everywhere ExecutionResult<T>
was previously used.

Part of #6111.
Fixes #6220 and #6125.

Co-authored-by: Ben Newman <ben@benjamn.com>
@hwillson
Copy link
Member

Addressed by #6194 and available in the latest @apollo/client@beta. Thanks!

@davewasmer
Copy link

FYI graphql-js has updated their types and added the generic back, with a default value now: graphql/graphql-js#2626

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants