I have the following code (in updates.Mutation) to update a list count after creating an item:
createItem: (result, args, cache, info) => {
cache.updateQuery({query: ListDocument, variables: {parentId: args.input.parent}}, data => {
data.parent.items.totalCount = data.parent.items.totalCount + 1;
return data;
})
}
There's currently no validation / hints on variables or data, which should be possible by passing the respective types as generics to updateQuery (similar to how useQuery/useMutation hooks work).
I also get a typescript error on data.parent.items:
Property items does not exist on type DataField
It would also be great to have the possibility to type the whole function createItem, so we could have validation / hints on args and result as well.
Right now I get another typescript error on args.input.parent:
Property parent does not exist on type string | number | boolean | Variables | ScalarObject | Scalar[] | Variables[]