How to work with discriminatedUnion and zodEffects effectively?
I have this zod schema with a discriminatedUnion: const mySchema = baseTypeSchema.extend({ id: z.string(), name: z.string(), specificData: z.discriminatedUnion("type", [specificDataA, specificDataB] as const) }); In addition, I have specific zodObject, such as the one below: const specificDataA = z.object({ type: z.literal("typeA"), isSomeDataRequired: z.boolean(), someData: z.string().optional() }); The issue is that I want to refine specificDataA, like this: const specificDataA = z .object({ type: z.literal("typeA"), isSomeDataRequired: z.boolean(), someData: z.string().optional() }) .refine
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.