You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use {} instead of z.object({}) you get TypeError: keyValidator._parse is not a function which is not clear. There should be understandable error message that says you need z.object({}) instead of plain object.
Same thing on z.enum('value', 'value') there is error TypeError: array.map is not a function instead of telling you to wrap it in array like z.enum(['value', 'value']).
The text was updated successfully, but these errors were encountered:
Also argument validation should be there for example if you pass arguments like z.string(pattern) when you meant z.string().regex(pattern) it works but should be error saying wrong arguments passed.
Thanks for opening this @cdtut.
Took me like 45 minutes to debug-I was passing zod.object instead of plain object into schema.extend()
I mean TS types did warn me, but in case you have the line ignored the error is mindboggling. Why doesn't it throw right there on the line where I call extend()?
If you use
{}
instead ofz.object({})
you getTypeError: keyValidator._parse is not a function
which is not clear. There should be understandable error message that says you needz.object({})
instead of plain object.Same thing on
z.enum('value', 'value')
there is errorTypeError: array.map is not a function
instead of telling you to wrap it in array likez.enum(['value', 'value'])
.The text was updated successfully, but these errors were encountered: