Zod - `require_error` in string not working when also using `min`
Does someone know how I can show the required_error in Zod?
when I parse this, it only shows that I need at least 2 characters, even if the string is empty
2 Replies
You passed a
''
, that is a valid string. You’re thinking of a falsy string value
An empty string is still a string, so it will pass the required errorThen what is the best way to say that name is required? Or is that not possible?
I got it fixed, if you use min 1 in combination with 2, it will work