-
-
Notifications
You must be signed in to change notification settings - Fork 469
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
feat: remove void
type from the ResponseResolverReturnType
#1675
feat: remove void
type from the ResponseResolverReturnType
#1675
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d444bcf:
|
Hey, @tnyo43. This is a great change! My only feedback is that we should open it against The current version of MSW should allow The next version, which is currently in progress under #1436, reworks the library in a major way, including more explicit intentions returned from the response resolver. The change you proposed falls nicely under that next version, so I'd be glad to include them there. |
dc87e70
to
d444bcf
Compare
@kettanaito Thanks for your feedback! I made a fix commit and changed the base branch. |
@@ -32,7 +32,6 @@ export type ResponseResolverReturnType< | |||
> = | |||
| (BodyType extends undefined ? Response : StrictResponse<BodyType>) | |||
| undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking if undefined
shouldn't be removed as well. The current return type allows for this:
rest.get('/resource', () => {
// side-effect
})
Edit: That use case is still allowed. See this for reference. You can return nothing (but you do have to have a return!) to fall through handlers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the feedback, @tnyo43! Welcome to contributors 🎉
I understand that omitting In my opinion, to force add Also, the |
I will close this PR as well as #1671. |
void
#1671This change will enforce the return type of resolvers not to be
void
.