We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to use .refine on a discriminated union element, but it's probably not possible.
.refine
const GetRegionRequestSchema = y.discriminatedUnion('type', [ z.object({ type: z.literal('COUNTRY') }), z.object({ type: z.literal('STATE'), country_id: z.string().optional(), coutry_name: z.string().optional(), }).refine((val) => !val.coutry_name && !val.country_id ? false : val), z.object({ type: z.literal('CITY'), state_id: z.string(), }) ])
I can do refine on the discriminatedUnion itself, but just wanted to know if this usecase is possible
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm trying to use
.refine
on a discriminated union element, but it's probably not possible.I can do refine on the discriminatedUnion itself, but just wanted to know if this usecase is possible
The text was updated successfully, but these errors were encountered: