Zod - how to define schema for number that can be one of few values

How can I define a schema that would accept a number which would be one of these values 10,25,50,100
1 Reply
Brendonovich
Brendonovich2y ago
If the type you want is 10 | 25 | 50 | 100, you can use z.union and z.literal: z.union([z.literal(10), z.literal(25), ...])
Want results from more Discord servers?
Add your server