Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: add optional message to nonNullable schema methods#2119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jquense merged 1 commit intojquense:masterfromranquild:master
Dec 27, 2023

Conversation

ranquild
Copy link
Contributor

Fixes#2069

Adds an optionalmsg?: Message argument tononNullable method on every schema object. The argument is already supported by thebase Schema class, and we only need to pass it properly with TypeScript.

Also updatesnullable andnonNullable signatures inREADME.md.

mikebridge reacted with thumbs up emoji
@ranquild
Copy link
ContributorAuthor

@jquense could you take a look, please?

@lmarvaud
Copy link

Hello,

It seem that the typing of "notNullable" and "nullable" had been swaped. InSchema.ts, inherited by few validators, only nonNullable takes a parameter.

yup/src/schema.ts

Lines 710 to 715 in5db2b2f

nullable():any{
returnthis.nullability(true);
}
nonNullable(message=locale.notNull):any{
returnthis.nullability(false,message);
}

Actually wouldn't it be cleaner to add those types in theSchema interface, to avoid code duplication and those type of error ?

@jquensejquense merged commit9e1df49 intojquense:masterDec 27, 2023
@jquense
Copy link
Owner

thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jquensejquensejquense approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

should allnonNullable receive amsg?: Message property?
3 participants
@ranquild@lmarvaud@jquense

[8]ページ先頭

©2009-2025 Movatter.jp