Code-Hex/graphql-codegen-typescript-validation-schema

[QUESTION]: nonOptionalTypename: supported?

smakinson opened this issue · 5 comments

Hi, Is it expected that using:

config: {
   ...
   nonOptionalTypename: true,
   schema: 'zod',
}

should prevent .optional() from being applied to __typename? It does not seem to do this when giving it a try.

@smakinson Could you give me more context because I'm not sure why don't you need __typename?

no reply.
Open again if you need anything else.

@Code-Hex for some projects, __typename plays a critical enough role (e.g. for discriminated unions) that graphql-codegen allows automatically including it in the generated typescript, even if it wasnt explicitly requested in the graphql document

it would be nice if typescript-validation-schema respected / had a consistent api with this configuration

edit: i got a head start on supporting nonOptionalTypename in 2822c7c

@btoo Could you share me your some use case using typename?