You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: z.deepStrict(), like z.deepPartial() for unknown keys #6721
Making every nested object strict by hand means rebuilding the schema, and it doesn't work for schemas you didn't write.
Proposed: z.deepStrict(schema), built the same way as z.deepPartial(): walk the schema with visit and make every object in the tree strict, through arrays, tuples, unions, intersections, records, wrappers, and z.lazy.
Intersections need no special case, since v4 already reconciles unrecognized_keys across both sides.
One design question: should an object that already sets its own unknown-key handling (z.looseObject(), .catchall()) keep it? I'd say yes, since a nested looseObject is a deliberate choice, though that differs from .strict(), which overrides a catchall.
This would be tree-shakeable like z.deepPartial(), with no cost unless imported.
Activity