-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Cache.modify types failing after upgrading to 3.8 #11171
Comments
Hi @Slessi! npm i @apollo/[email protected] |
@phryneas Edit: Actually, if I change my code to use I still get readonly errors with this signature though of using cache.modify({
id: cache.identify(team),
fields: {
tracks(refs: Reference[], { toReference }) {
const ref = toReference(track);
if (!ref) return refs;
return refs.concat(ref); // TS error here
},
},
}) |
Yeah, that was a part of the types that was just generally incorrect, we had to change that: (We also cannot check for Unfortunately neither is compatible with the code you previously had, because it was ignoring the option of |
Are there any plans to merge this PR anytime soon? |
I'm sorry - we're currently in the middle of a lot of conferences, so it's a lot of traveling right now. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
This code I use to add an item to a list in the cache passes typechecking for me in 3.7, but does not in 3.8.
I suspect due to the changes in #10895
If I try to make it work like the changes suggest by adding a generic here:
cache.modify<T>
and dropping the manualReference[]
type from the arguments, the error grows longer (but triggers on same line):At the moment, the only way I can find to silence the error is to use no generic and no
Reference[]
(which effectively makesrefs
any again)Link to Reproduction
https://codesandbox.io/s/gracious-ardinghelli-mv4h49?file=/src/index.tsx
Reproduction Steps
Click repro, check TS errors
The text was updated successfully, but these errors were encountered: