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

Add optional generic type parms for variables on low level methods #3588

Merged
merged 5 commits into from
Jul 16, 2018
Merged

Add optional generic type parms for variables on low level methods #3588

merged 5 commits into from
Jul 16, 2018

Conversation

mvestergaard
Copy link
Contributor

Similar to #3541, the ability to specify the type of variables is missing on watchQuery, query, mutate and subscribe methods in ApolloClient.

This PR adds optional generic type parameters to those methods that default to OperationVariables which seems to be used throughout the codebase.
Related to that, the parameters added in #3541 that were defaulted to any, now also use OperationVariables where it makes sense.

@apollo-cla
Copy link

apollo-cla commented Jun 14, 2018

Warnings
⚠️

There are library changes, but not tests. That's OK as long as you're refactoring existing code

Generated by 🚫 dangerJS

@keyfu
Copy link

keyfu commented Jun 19, 2018

My errors.

ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-client/ApolloClient.d.ts (108,27): Generic type 'Query' requires 1 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-client/ApolloClient.d.ts (120,30): Generic type 'Fragment' requires 1 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-client/ApolloClient.d.ts (126,25): Generic type 'WriteQueryOptions<TData, TVariables>' requires 2 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-client/ApolloClient.d.ts (138,28): Generic type 'WriteFragmentOptions<TData, TVariables>' requires 2 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-client/ApolloClient.d.ts (149,24): Generic type 'WriteDataOptions' requires 1 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts (25,35): Generic type 'Query' requires 1 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts (26,41): Generic type 'Fragment' requires 1 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts (27,25): Generic type 'WriteQueryOptions<TData, TVariables>' requires 2 type argument(s).
ERROR in /home/keyfu/dm-customerapp-ui/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts (28,28): Generic type 'WriteFragmentOptions<TData, TVariables>' requires 2 type argument(s).

I'm using angular 4 and this is my package.json
"apollo-angular": "1.0.1",
"apollo-angular-link-http": "1.0.2",
"apollo-cache-inmemory": "1.1.10",
"apollo-client": "2.2.8",
"graphql": "^0.13.2",
"graphql-tag": "^2.8.0",

@mvestergaard
Copy link
Contributor Author

@keyfu I fail to see the relevance

Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @mvestergaard - thanks very much!

@hwillson hwillson merged commit 9843236 into apollographql:master Jul 16, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 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

Successfully merging this pull request may close these issues.

4 participants