Hello,
Is there a way to configure apollo cache with typescript so fields in cache.modify
won’t be any?
For example I have a query
feed () {
items {
id
}
nextToken
}
and later I want to optimistically update it via:
cache.modify({
fields: {
// existing is any here
feed(existing) {
const newPostRef = client.cache.writeFragment({
fragment: PostCardFragment,
fragmentName: 'PostCardFragment',
data: post,
});
if (newPostRef) {
return {
...existing,
items: [newPostRef, ...existing.items],
};
}
return existing;
},
},
})
How am I supposed to type existing
? Are there any tricks to do that?
Thank you