-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
v4: isOptional
may throw despite using safeParse
#4159
New issue
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Zod 3 does actually throw true I'd be curious what code produces different behavior in Zod 3 vs Zod 4. |
the following code does not throw with Zod 3 but it does with Zod 4: z.promise(z.any()).isOptional();
And I'm not even validating anything. I'm asking Zod if the schema is optional. It is Zod who is using |
Current implementation:
despite using
safeParse
(which is implying to be safe), still can trow this thing:It did not happen in v3.
Maybe it should be catched by
safeParse
?The text was updated successfully, but these errors were encountered: