zod
zod copied to clipboard
fix: Fix `ZodCatch`
This PR fixes ZodCatch
.
It looks like ZodCatch
was a product of a quick copy-paste from ZodDefault
, which introduced some bugs to it.
- The
output
of aZodCatch
was previously defined asutil.noUndefined<T["_output"]>
(fromZodDefault
) when it should actually beT["_output"] | <<catch value>>
. - The
input
of aZodCatch
was previously defined asT["_input"] | undefined
(also fromZodDefault
) when it should actually be theT["_input"]
unchanged. - Renamed props and methods from
default
tocatch
.
Deploy Preview for guileless-rolypoly-866f8a ready!
Name | Link |
---|---|
Latest commit | e4845e00dcf96e45218cd8f1479510763bad233f |
Latest deploy log | https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/63a6a0634f3f6b000805f7ab |
Deploy Preview | https://deploy-preview-1733--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.
Yikes, good catch.
I pushed a commit to fix the tests, since those weren't updated. I also got rid of the second generic on ZodCatch
- the value passed into .catch()
should match T['output']
exactly and there's no need for additional inference there. Good PR!
Which release is this planned to be put into ?
Landed in [email protected]