graphql-code-generator
graphql-code-generator copied to clipboard
Support auto selecting ids in typescript-operations
Is your feature request related to a problem? Please describe.
I'm always frustrated when I use @graphql-codegen/typescript-operations
to generate mock types for my Relay queries. It's frustrating because Relay will automatically select the id
field behind the scenes if your type has one, but the generated types from typescript-operations
do not include the id
field.
This leads to me drop a bunch of @ts-expect-error
s in my test files which actually make the entire object not type safe.
Describe the solution you'd like
I'd like typescript-operations
to automatically include the id
in the selection set if the type allows for it.k
Describe alternatives you've considered
I haven't thought of any.
Additional context
I've taken a stab at an implementation in this PR
I created a repro of this problem in this repo.
Steps to repro
- Clone that repo
- yarn install
- yarn jest
- See the following error
can we please get support for this?