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
Intuita
Intuita

Usage →

Intuita CLI:

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

Intuita 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