Closed lbenevento closed 1 year ago
Hello @lbenevento !
Yes, totally agree with you 🙂
In v0.5, __typename
will be optional by default for types, except for union members and interface implementing types.
For now in v0.4, here's how you can make __typename
optional:
const config: CodegenConfig = {
schema: "**/schema.graphql",
generates: {
"src/schema": defineConfig({
typesPluginsConfig: {
nonOptionalTypename: false, // Note that in v0.5, this will be set automatically
},
}),
},
};
v0.5 is just around the corner 🙂 I'm adding a few features upstream in typescript-resolvers
so we are just waiting for this PR to be merged.
Let me know if you have any other questions!
Thank you, I did read the documentation but I didn't quite catch that option! I'll use that while waiting for v0.5 to ship. Awesome work! 😁
Describe the bug __typename is required to be set explicitly. I'm actually not sure if this is the intended behavior.
To Reproduce Steps to reproduce the behavior: _1. I have just set everything up as per the documentation.
Expected behavior I think the most intuitive approach would be for the __typename property to be inferred based on the type itself.