Skip to content

fix: typefix the string.ensure() method#2296

Open
vmanera wants to merge 1 commit into
jquense:masterfrom
vmanera:fix/ensure-default-typegen
Open

fix: typefix the string.ensure() method#2296
vmanera wants to merge 1 commit into
jquense:masterfrom
vmanera:fix/ensure-default-typegen

Conversation

@vmanera

@vmanera vmanera commented Jul 19, 2025

Copy link
Copy Markdown

The string.ensure() method applies.default(''), however this information does not flow to typescript. This happens because the explicit return type of the method causes a loss of information about the transforms that happen within. The typing changes I have in this PR will ensure the type information flows through correctly.

Pragmatically, this issues effects the use of Schema.getDefault() method. Without this fix, any strings using .ensure() will have a type of undefined, but a runtime value of "".

@deansimcox deansimcox 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.

Love your work.
Happy to see the as any on line 271 has been removed.
5 ⭐ 's

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