URQL GraphCache creates type error when there are no mutations
Issue workflow progress
- [x] 1. The issue provides a reproduction: https://github.com/matthew-petrie/graphql-code-generator-issue-sandbox-template
- [x] 2. A failing test has been provided (see linked PR)
- [x] 3. A local solution has been provided (see https://github.com/matthew-petrie/graphql-code-generator-issue-sandbox-template)
- [x] 4. A pull request is pending review
Describe the bug
The typescript-urql-graphcache plugin causes a typescript error in the generated type file for the type GraphCacheOptimisticUpdaters if the schema has no mutations:

To Reproduce Reproduction repo: https://github.com/matthew-petrie/graphql-code-generator-issue-sandbox-template
Steps to reproduce the behavior:
- My GraphQL schema:
type Query {
user(id: ID!): User!
}
type User {
id: ID!
username: String!
email: String!
}
- My GraphQL operations:
query user {
user(id: 1) {
id
username
email
}
}
- My
codegen.ymlconfig file:
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
plugins:
- typescript
- typescript-operations
- typescript-urql-graphcache
Expected behavior
For typescript-urql-graphcache to generate a types file with no Typescript errors. If there are no mutations GraphCacheOptimisticUpdaters should be output as:
export type GraphCacheOptimisticUpdaters = {};
Environment:
- OS: macOS Monterey 12.3 - M1 Pro chip
@graphql-codegen/typescript-urql-graphcache: ^2.2.13typescript: ^4.7.2- NodeJS: v16.13.1
Raised a PR to fix this bug: https://github.com/dotansimha/graphql-code-generator/pull/7911
@saihaj I think this issue is resolves with the merge of the PR linked above and can be closed