MSW V2 - Replace printHandlers() calls

A new way of listing all handlers is preferred in msw v2. This codemod replaces printHandlers() calls with the new way of doing that.

Estimated time saving
5 minutes/occurrence
Change mode
Applicability criteria

MSW version >= 1.0.0

Made by
Codemod.com
Codemod.com

Usage →

Codemod CLI:

intuita msw/2/print-handler
copy CLI command icon

Codemod VS Code extension:

vs code logo
Run in VS Code

Description

A new way of listing all handlers is preferred in msw v2. This codemod replaces printHandlers() calls with the new way of doing that.

Example

Before

worker.printHandlers()

After

worker.listHandlers().forEach((handler) => {
  console.log(handler.info.header)
})

Links for more info