colinhacks / zod

TypeScript-first schema validation with static type inference
https://zod.dev
MIT License
33.95k stars 1.19k forks source link

Error Message docs inconsistent with actual behaviour for string().date() validation method #3808

Open alex-delia opened 3 weeks ago

alex-delia commented 3 weeks ago

The string().date() validation message takes a string as a parameter, date(message?: string): ZodString; whereas all the rest of the methods take in an errorUtil.ErrMessage, ex: email(message?: errorUtil.ErrMessage): ZodString;

This is not a huge issue, though it is inconsistent with the docs which show error messages for the string().date() validator can be set in this way z.string().date({ message: "Invalid date string!" }); when they actually are set like this z.string().date("Invalid date string!");