-
-
Notifications
You must be signed in to change notification settings - Fork 571
fix(HttpResponse): preserve request body type after cloning the request #2600
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
Conversation
|
Hi, @Slessi. This is interesting! Would you like to add a few type tests for this? You can find the tests we already have at https://github.com/mswjs/msw/tree/main/test/typings to use as an inspiration. This looks good, I'd love to have this released. |
…Type in the cloned request When using clone() on a StrictRequest, you lose the generic typing it offers for BodyType on json(). With this change, clone() will return another StrictRequest, instead of the base Request.
fc91be1 to
91c7d63
Compare
|
@kettanaito I added one, if you would like anything more specific let me know. As an side not sure how to run tests locally 🤔 I run into issues Test output |
kettanaito
left a comment
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.
This is great! Thanks, @Slessi. Those issues you linked might be related to two things:
- The library has to be built before you run type tests, so run
pnpm build. - You are using a TS version that we don't officially support.
commit: |
Released: v2.11.4 🎉This has been released in v2.11.4. Get these changes by running the following command: Predictable release automation by Release. |
When using
clone()on aStrictRequest, you lose the generic typing it offers forBodyTypeonjson(). With this change,clone()will return anotherStrictRequest, instead of the baseRequest.