You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exporttypeCyclingOptimizationInput=/** Define optimization by weighing three criteria. */{triangle: TriangleCyclingFactorsInput;type?: never;}|/** Use one of the predefined optimization types. */{triangle?: never;type: CyclingOptimizationType;};
When I generate the graphql code without this plugin, it works fine. However, when trying to generate code with this plugin, I get a mismatch between the generated zod schema and the typescript type. I'm not sure how to resolve this.
I believe the type above should lead to a discriminated union zod type, something like:
The types of 'optimization._type' are incompatible between these types.
Type '{ type: CyclingOptimizationType | undefined; triangle: TriangleCyclingFactorsInput | undefined; } | { type: CyclingOptimizationType | undefined; triangle: TriangleCyclingFactorsInput | undefined; } | null | undefined' is not assignable to type 'InputMaybe | undefined'.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a typescript type that looks like this:
When I generate the graphql code without this plugin, it works fine. However, when trying to generate code with this plugin, I get a mismatch between the generated zod schema and the typescript type. I'm not sure how to resolve this.
I believe the type above should lead to a discriminated union zod type, something like:
However, I get
This leads to the error
The types of 'optimization._type' are incompatible between these types.
Type '{ type: CyclingOptimizationType | undefined; triangle: TriangleCyclingFactorsInput | undefined; } | { type: CyclingOptimizationType | undefined; triangle: TriangleCyclingFactorsInput | undefined; } | null | undefined' is not assignable to type 'InputMaybe | undefined'.
which refers to
All of these types are from the open trip planner project found here: https://github.com/opentripplanner/OpenTripPlanner
My codegen.ts is:
Beta Was this translation helpful? Give feedback.
All reactions