-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
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
feat: single method to comine .unwrap().unwrap()
#3456
Comments
My current thinking on this is described here: #3141 (comment) If Zod ever did implemented z.string().or(z.null()).refine(()=>true).transform(val => Math.random() > 0.5 ? val : undefined).nonNullable() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, if you have a schema with both optional and nullable, you have to call unwrap twice in order to get the base type. It would be nice to get it immediately.
I propose adding something like
.nonnullable()
(to match TypeScript'sNonNullable<T>
type) that does this in one shot:Sandbox: https://stackblitz.com/edit/vitejs-vite-ursctp?file=src%2Fmain.ts
The text was updated successfully, but these errors were encountered: