A

msw/2/upgrade-recipe

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

This recipe is a set of codemods that will upgrade your project from using msw v1 to v2.

The recipe includes the following codemods:

FNs

This recipe does not change the signatures of MSW handlers, if they were called using a custom factory function, for example to provide more type-safety or else. For example, the following code will only be partially updated:

ts

Also, if you were using req.body in your interceptors, this codemod will blindly assume you want await request.json() instead of any other type. You will have to correct that manually.

Ready to contribute?

Build your own codemod and share it with the community.