Describe the bug
If the export-type being used and the schema is referencing another schema with the z.ZodType declaration, zod's z.discriminatedUnion wont' work.
Should not throw an error, however I think the root of the issue us that ZodType does not work with the discriminatedUnion
Additional context
I think this reveals an under laying issue. const MoneyMetric: z.ZodType<MoneyMetric> = approach works nicely to eliminate the TS7056 error, but on the other hand the schemas which has the ZodType type casting no longer "real" Zod schemas, they cannot be merge/extend and it seems these cannot be part of the discriminatedUnion declaration
Describe the bug If the
export-type
being used and the schema is referencing another schema with thez.ZodType
declaration, zod'sz.discriminatedUnion
wont' work.Minimal reproduction Example
Check the metric field on
Pet
Expected behavior
Should not throw an error, however I think the root of the issue us that ZodType does not work with the
discriminatedUnion
Additional context I think this reveals an under laying issue.
const MoneyMetric: z.ZodType<MoneyMetric> =
approach works nicely to eliminate theTS7056
error, but on the other hand the schemas which has the ZodType type casting no longer "real" Zod schemas, they cannot bemerge
/extend
and it seems these cannot be part of thediscriminatedUnion
declaration