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 Error to return type of async validator #89

Merged
merged 2 commits into from
May 4, 2022

Conversation

vjau
Copy link
Contributor

@vjau vjau commented May 3, 2022

This PR changes the Typescript definition.
When using an async validator, errors are either throwed or returned.
The initial typing only considered the case when Error where throwed. This PR add a union type including Error on the returned Promise.
The test is also modified by returning an Error

Checklist

@vjau
Copy link
Contributor Author

vjau commented May 3, 2022

Sorry, i have seen that there is already a pending PR addressing what this PR is doing. #58
However, #58 is more ambitious (i have actually tried to do what #58 try to do the whole day without success), i think this more limited fix could be merged for now.
Thank you.

index.test-d.ts Show resolved Hide resolved
@vjau
Copy link
Contributor Author

vjau commented May 4, 2022

I have splitted the test as requested

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina requested a review from climba03003 May 4, 2022 09:16
Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

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

LGTM.

@mcollina mcollina merged commit 7ec8a6d into fastify:master May 4, 2022
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.

3 participants