I want to validate a gender field with Zod using z.nativeEnum()
, But my custom error messages don't apply:
gender: z.nativeEnum(Gender, {
invalid_type_error: 'Le sexe doit être homme ou femme.',
required_error: 'Le sexe est obligatoire',
}),
but when not selecting an option the displayed error is:
What's the error here ?