docs: lead the properties section with the check and add a Zod Mini tab - #6598
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes This review covers the API-reference update for z.instanceof() properties after z.properties() returned to its check role.
- Shared properties example Documents the iterable
z.properties()check with equivalent Zod and Zod Mini examples, while retaining classic.properties()as narrowing sugar. - Instance identity Moves the in-place, identity-preserving parsing behavior to the
z.instanceof()introduction and illustrates it directly.
GPT Terra | 𝕏
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.

Since #6594
z.properties()is a check, but the API reference still led withz.instanceof().properties(), which Zod Mini doesn't have. The section now opens with the spread form both builds share, in a Zod / Zod Mini tab pair, and the method follows as the Zod-only sugar that narrows the inferred type.Kept the method rather than dropping it, since the narrowing is the only thing it buys —
.check()returnsthisin both builds, so the spread form infers plainResponse. Also moved the no-clone fact up into the Instanceof intro and stated it directly: parsing returns the exact object that was passed in, which covers every instance schema rather than just the properties check.Refs #6594