Msw/2/Lifecycle Events Signature

1.0.2Last update Jan 10, 2025
by@Codemod
Msw
migration

In msw v2, lifecycle events callback methods have changed their signature. This codemod replaces usages if its arguments with the new ones.

Before

server.events.on("request:start", (req, reqId) => {
doStuff(req, reqId);
});

After

server.events.on("request:start", ({ request, requestId }) => {
doStuff(request, requestId);
});

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now