Skip to content

Test chained brands on zod objects in zodToConvex - #1053

Merged
Nicolapps merged 2 commits into
mainfrom
nicolas/image-regression-fix
Oct 29, 2026
Merged

Nicolapps merged 2 commits into
mainfrom
nicolas/image-regression-fix

Conversation

@Nicolapps

@Nicolapps Nicolapps commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

z.object(…).brand("A").brand("B") should keep both brands in the type of the converted validator. Since #1051, zodToConvex only keeps the outermost brand (reported by cubic on #1051).

This PR first adds the regression test (expected to fail CI), then the fix.

`z.object(…).brand("A").brand("B")` should keep both brands in the
converted validator's type. Since #1051, only the outermost brand is
kept.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/convex-helpers@1053

commit: 983dfb5

Since #1051, the brand of a branded object came from
`$ZodBranded<infer Inner, infer Brand>`, which only gives the outermost
brand, and the inner brands were dropped from `Inner`'s inferred type.
Take the brands from the object's own inferred type instead, so that
`.brand("A").brand("B")` keeps both.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@Nicolapps
Nicolapps merged commit 4c58567 into main Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant