janglad - This seems like it might be worth a b...
This seems like it might be worth a bug report/request but does anyone know if there's a good way around this? I assume internally
message
is being evaluated as truthy/falsy and thus an empty string isn't picked up
3 Replies
yeah, although I don't see the obvious bug in the code.
Oh, here it is: https://github.com/colinhacks/zod/blob/3e4f71e857e75da722bd7e735b6d657a70682df2/src/helpers/parseUtil.ts#L31
GitHub
zod/src/helpers/parseUtil.ts at 3e4f71e857e75da722bd7e735b6d657a706...
TypeScript-first schema validation with static type inference - colinhacks/zod
alright made an issue, thank you 👍 https://github.com/colinhacks/zod/issues/3101
GitHub
Empty error message gets evaluated as falsy and overriden · Issue #...
Doing this import z from 'zod'; z.number().min(0, { message: '' }).parse(-1); Results in an error of Error: [ { "code": "too_small", "minimum": 0, &quo...