Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added info about addMethod for this.test() #1817

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brianwhaley
Copy link

Updated README.md to add info about addMethod for this.test() re: #1814

@@ -566,6 +566,19 @@ import { addMethod, Schema } from 'yup';
addMethod(Schema, 'myMethod', ...)
```


You can add your test methods to the schema using `addMethod` by returning `this.test()`. This will allow you to reuse them as well.
Copy link
Owner

Choose a reason for hiding this comment

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

Rather than add add a new section here, let's add the code example to the first code block and then demonstrate how to use the new added methods. For extra clarity i think it's worth adding a few words about this being the the schema instance, and so any of the methods documented in the docs will be on them.

Copy link
Author

Choose a reason for hiding this comment

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

Sure. I will make the change and resubmit.

@Svish
Copy link

Svish commented Feb 16, 2023

Would be much better if this example was in Typescript, and included what one would need to add to the .d.ts to make things work properly.

@zammit123
Copy link

Yes a Typescript example would be very helpful. Please add one.

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.

None yet

4 participants