-
We are defining a custom key as it is documented here:
But we get a type error:
The cache works as expected though, and it doesn't if we remove this custom key. Here someone brought up the same problem #2172 and what they did as a workaround still works, but is there another solution? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No, without typegen there's no way of knowing what the scalar value of the field may be. Hence, it's typed more generically, and if you know the type you should cast it to indicate that it's safe. In general, these are the kind of cases where typegen is really useful: https://www.npmjs.com/package/@graphql-codegen/typescript-urql-graphcache |
Beta Was this translation helpful? Give feedback.
No, without typegen there's no way of knowing what the scalar value of the field may be. Hence, it's typed more generically, and if you know the type you should cast it to indicate that it's safe.
In general, these are the kind of cases where typegen is really useful: https://www.npmjs.com/package/@graphql-codegen/typescript-urql-graphcache
However, we haven't replaced the GraphQL Codegen plugin with our own implementation, e.g. in
gql.tada
yet.