colinhacks / zod

TypeScript-first schema validation with static type inference
https://zod.dev
MIT License
33.09k stars 1.15k forks source link

feat: added support for type negation with z.not() and .not() method … #3709

Open Kumar06Lav opened 1 month ago

Kumar06Lav commented 1 month ago

Added support for type negation using z.not() and the .not() method in schema validation. This enhancement allows schemas to explicitly reject specific types, offering greater flexibility in data validation.

This implementation was done for ticket #2862

Changes:

Introduced the z.not() method to create schemas that reject a specified type. Enabled the .not() method to be used directly on existing schemas for easier exclusion of types. Added comprehensive test cases to validate the new z.not() functionality. Updated the documentation to include examples and usage guidelines for z.not().

netlify[bot] commented 1 month ago

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
Latest commit 61dc91e6118cf5f49fe6ab487e5c2015ca4ec51d
Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/66bc613c4b54c60008132450
Deploy Preview https://deploy-preview-3709--guileless-rolypoly-866f8a.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Kumar06Lav commented 4 weeks ago

@colinhacks Could you please help me with review of my PR and merging it(if everything is fine)?