zod
zod copied to clipboard
feat: Add `extract`/`exclude` methods to `ZodEnum`
This PR adds two methods to ZodEnum:
extractexclude
Both work exactly like the TS utility types of the same name.
You call .extract() with values that exist in the enum, and it returns a new one with these values only. The same thing for .exclude() but it returns a new enum without the values you passed in.
Example
Deploy Preview for guileless-rolypoly-866f8a ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 22038ae921ec3cc91c7acac03dc06016536dd36d |
| Latest deploy log | https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/63940026ecd696000abc1062 |
| Deploy Preview | https://deploy-preview-1652--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.
I dig it! Sorry I couldn't fit this into 3.20 - had to stop tinkering and just cut a release. The naming is of course perfect. This'll get merged soon.