zod icon indicating copy to clipboard operation
zod copied to clipboard

[docs] add notice about strictObject

Open cupcakearmy opened this issue 2 years ago • 5 comments

Found strictObject in this ticket and i wondered if i missed it in the docs, but it cannot be found.

cupcakearmy avatar Jun 19 '23 08:06 cupcakearmy

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
Latest commit a64f385fd0fbca5986950131c6df579aeacad167
Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/6490124a0980660008f15830
Deploy Preview https://deploy-preview-2512--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 settings.

netlify[bot] avatar Jun 19 '23 08:06 netlify[bot]

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.

stale[bot] avatar Sep 17 '23 23:09 stale[bot]

Def not stale my bot

cupcakearmy avatar Sep 20 '23 11:09 cupcakearmy

In the issue, I also saw that it is "the recommended approach". I just find it weird that it's not recommended anywhere 🤔

vixalien avatar Nov 28 '23 15:11 vixalien

@colinhacks ping ❤️

cupcakearmy avatar Feb 20 '24 16:02 cupcakearmy

I appreciate the PR, though tbh I'd prefer people not use this. It opens up the door to a bunch of top-level APIs that are better kept as methods (e.g. z.optionalString()). I generally don't like having multiple ways of achieving the same thing.

Also, there will likely be a way to configure this setting globally in Zod 4, which solves the core problem better than z.strictObject() anyway.


In the issue, I also saw that it is "the recommended approach". I just find it weird that it's not recommended anywhere 🤔

cc @vixalien It is the recommended approach for achieving the OP's suggestion of a deepStrict(), not in the general case.

colinhacks avatar Mar 22 '24 00:03 colinhacks

Sure :) Global option would be reaaallyy nice! Thanks for the time, so you on v4 🤘

cupcakearmy avatar Mar 24 '24 19:03 cupcakearmy