Skip to content

Conversation

@gary-ix
Copy link
Contributor

@gary-ix gary-ix commented Nov 16, 2025

Object fields with .default() were incorrectly inferred as optional (T | undefined)
instead of required (T). This fix ensures
that zodOutputToConvex correctly uses OUTPUT types for object and union
fields, matching Zod's output type.

I ignored zod/v4, saw it was marked as WIP in the changelog.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Member

@Nicolapps Nicolapps left a comment

Choose a reason for hiding this comment

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

Thank you for the fix!

I ignored zod/v4, saw it was marked as WIP in the changelog.

The v4 implementation is already correct:

testZodOutputToConvex(z.string().default("hello"), v.string());

@Nicolapps Nicolapps merged commit a57e08b into get-convex:main Nov 17, 2025
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.

2 participants