zod
zod copied to clipboard
feat: Add `unwrapDeep` to `ZodOptional` and `ZodNullable`
This PR adds the unwrapDeep
method to both ZodOptional
s and ZodNullable
s, which recursively unwraps the schema in case of multiple calls to .optional()
or .nullable()
.
I understand that this will have more impact on the library itself than on the end users, for example, we can now use these methods:
- on the
deepPartial
method ofZodObject
; or - to possibly create a
deepPartial
onZodTuple
s in the future; or - to improve
ZodUnion
by unwrapping the unnecessarily chained optionals/nullables prior to parsing.
Anyway, it doesn't hurt to expose these methods too.
Deploy Preview for guileless-rolypoly-866f8a ready!
Built without sensitive environment variables
Name | Link |
---|---|
Latest commit | bcf0fba4cdb527a217b4b0e79200f58528b13465 |
Latest deploy log | https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/639c632ccf9a710008e37b75 |
Deploy Preview | https://deploy-preview-1708--guileless-rolypoly-866f8a.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.