Repository navigation
Make z.properties() a check again - #6594
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes across the check implementation, Classic/Mini exports, compiler, JSON Schema conversion, traversal, memoization, tests, and documentation.
- Check-only API: Moves
z.properties()into$ZodCheckProperties, preserving direct and spread.check()usage, async validation, symbol keys, and input-side narrowing through.properties(). - Schema removal: Removes standalone parsing, inference, JSON Schema conversion, and cycle support. This intentionally removes an API shipped in 4.6.0, as acknowledged in the PR description.
- Shared cleanup: Retains check compilation while removing schema-only dispatch and support code; no live internal consumers of the removed schema types were found.
Local validation passed: 415 test files, 6,632 tests, and no type errors, covering v4, compile-mode, documentation examples, and Mini exports. Performance and bundle deltas were not independently remeasured.
GPT Astra | 𝕏
Owner
Author
|
Landed in v4.6.3. |
colinhacks
added a commit
that referenced
this pull request
Sep 13, 2026
…ab (#6598) z.properties() is a check again since #6594, so the section now opens with the spread form both Zod and Zod Mini have, in a tab pair. The z.instanceof() method follows as the Zod-only sugar that narrows the inferred type. Also states that z.instanceof() returns the exact object passed in. The no-clone fact moves up to the Instanceof intro, where it covers every instance schema rather than just the properties check.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Reverts the schema role that #6536 gave
z.properties(). It is a check again, as in 4.5: it spreads into.check(), andz.instanceof().properties()stays as sugar over it. The standalone form is gone —z.properties(shape).parse(),z.inferof it,z.toJSONSchema()andz.compile()of it, and the cycle tracking only the schema role had.The schema form was a trap with transforms. A transform inside the shape ran and was discarded, so the parsed value and the inferred type were both the input side, and writing the result back is not an option for the objects the feature exists for: assigning to a getter-only property such as
Response.statusthrows. As a check, "the value is never changed" is what a check already means.What stays: every failing key reports, symbol keys, the
paramsargument, and compile support. The check now lives next to$ZodCheckPropertyas$ZodCheckPropertiesand installs itsSymbol.iteratoras an own property, so the symbol-key loop inutil.membersand the memoizer's callable arm go with the schema role. The API reference drops the standalone paragraph; the 4.6 post already led with the method.Bundle, gzipped from the built package: mini −17 / −16 / −16 on boolean / string / object, classic −35 / −38 / −44, the named import −447. Runtime and memory: the check body is the same code moved, construction pays one
Object.definePropertyperz.properties()call, and each check instance carries one extra own property.This removes an API that shipped in 4.6.0.