zod
zod copied to clipboard
Restrict .pick()/.omit() mask type to only known properties
Current
Both the methods .pick and .omit accept properties that don't exist in the schema.
const schema = z.object({
existedProperty: z.string(),
});
const pick = schema.pick({
existedProperty: true,
NOT_existed_property: true, // there is no TypeScript error
});
Fixed
Both the methods .pick and .omit now only accept known properties.
const schema = z.object({
existedProperty: z.string(),
});
const pick = schema.pick({
existedProperty: true,
NOT_existed_property: true, // there is a TypeScript error
});
resolves https://github.com/colinhacks/zod/issues/895
Deploy Preview for guileless-rolypoly-866f8a ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 8d364f029614dec32c1852d0bdabbebee8d4bb58 |
| Latest deploy log | https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/65d31b03a96a09000805d377 |
| Deploy Preview | https://deploy-preview-3255--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 configuration.
Thank you! Fascinating that this works...
This has landed in Zod 3.23.
https://github.com/colinhacks/zod/releases/tag/v3.23.0