is it possible to generate typing for the cache object of apollo client? #10384
Unanswered
jingjiezhou2021
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I’m using
graphql-codegenwithapollo-client. Everything works great except one thing:I tried to update cache after mutation, the
updatefunction ofclient.mutatedoesn’t have typings for thecacheparameter(more specifically it is ofApolloCache<any>), I expected it to be typed based on the graphql schema so that i can modify the desired field in cache data very easily.Example:
You can access
cacheproperty on theclientinstance which has typeApolloCache<NormalizedCacheObject>but this is not connected with graphql schema.Either way when you try to modify the fields in the cache data there is no typing specifying the fields, you will have to manually input the name of the field
I couldn’t find any mention of this in the docs
Questions:
cacheobject?Beta Was this translation helpful? Give feedback.
All reactions