Setting Custom Error Messages on Zod Unions
Hello,
I'd like to set a custom error message when a union of literals does not pass parsing in zod. With other constraints, such as
But I am not sure how to do so on this union:
Could anyone help me out? Thanks!
I'd like to set a custom error message when a union of literals does not pass parsing in zod. With other constraints, such as
.min() or .max() you can set a error message like this:But I am not sure how to do so on this union:
Could anyone help me out? Thanks!
