Replies: 2 comments 1 reply
-
Sorry, this is not really a bug, but more like a typescript usage question related to this library. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey, @tiborsaas. You should annotate your request body in the life-cycle events listener using the import { MockedRequest } from 'msw'
interface MyBody {
emailChangeParams {
email: string
}
}
server.events.on('request:start', (req: MockedRequest<MyBody>) => {
const { emailChangeParams } = req.body
}) There is no need to extend |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Environment
Request handlers
Actual request
Current behavior
Accessing
req.body.emailChangeParams
withoutChangeParams
yields:Expected behavior
Creating the
ChangeParams
interface does work, but I'm wondering if it's possible to get rid of theany
type and be even more specific.Beta Was this translation helpful? Give feedback.
All reactions