Skip to content

Conversation

@kimjoar
Copy link
Contributor

@kimjoar kimjoar commented Jan 6, 2026

When using schema.String({ required: false }) with only one type parameter, TypeScript would default the second type parameter O to {} instead of inferring it from the argument. This caused the inferred type to be CustomType instead of CustomType | undefined.

Fixed by adding function overloads that specifically handle the { required: false } case, allowing the options type to be captured correctly without requiring explicit type parameters.

🤖 Generated with Claude Code

…e })

When using schema.String<CustomType>({ required: false }) with only one
type parameter, TypeScript would default the second type parameter O to {}
instead of inferring it from the argument. This caused the inferred type
to be CustomType instead of CustomType | undefined.

Fixed by adding function overloads that specifically handle the
{ required: false } case, allowing the options type to be captured
correctly without requiring explicit type parameters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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