MSW V2 - Replace printHandlers() calls

verified codemod icon

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

MSW
ts-morph
Estimated time saving
5 minutes/occurrence
Change mode
Autonomous
Applicability criteria

MSW version >= 1.0.0

Made by
Codemod.com
Codemod.com

Usage →

Codemod CLI:

intalling vs code extension tooltip icon
codemod msw/2/print-handler
copy CLI command icon

Codemod VS Code extension:

intalling vs code extension tooltip icon
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