Skip to content

Conversation

@madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented Jan 7, 2026

It is currently not possible to successfully run the TypeScript compiler in the root of the project with npm run compile. It complains with TypeScript errors. This was caused by the upgrade to MSW 2, and our build pipeline currently only runs the TypeScript compiler on part of the project, not catching the TypeScript errors in the mock files.

Mock Handlers (Using Proper MSW v2 Generics)

Updated all handlers to use the correct MSW v2 generic signature:

http.post<PathParams, RequestBodyType>(url, handler)

E2E Files (MSW v1 → v2 Migration)

We also missed the upgrade for the e2e Playwright files. I am not sure if these are in use or if we can safely delete this folder.

  • Converted from old MSW v1 syntax (rest, res, ctx) to MSW v2 syntax (http, HttpResponse)

Copilot AI review requested due to automatic review settings January 7, 2026 11:16
@madsrasmussen madsrasmussen added the release/no-notes Not directly part of the release (updating README, build scripts, tests, etc.) label Jan 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes TypeScript compilation errors introduced by the MSW (Mock Service Worker) v2 upgrade. The changes ensure TypeScript can successfully compile the entire project by properly migrating MSW handler syntax and fixing type issues in mock files.

Key Changes:

  • Migrated e2e test files from MSW v1 syntax (rest, res, ctx) to MSW v2 syntax (http, HttpResponse)
  • Updated mock handlers to use correct MSW v2 generic signature: http.post<PathParams, RequestBodyType>
  • Fixed request body handling by extracting userIds from reference objects to simple string arrays

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Umbraco.Web.UI.Client/src/mocks/handlers/user/unlock.handlers.ts Added proper MSW v2 generics and fixed userIds mapping from reference objects to string IDs
src/Umbraco.Web.UI.Client/src/mocks/handlers/user/set-user-groups.handlers.ts Added proper MSW v2 generics and type import for request model
src/Umbraco.Web.UI.Client/src/mocks/handlers/user/invite.handlers.ts Added proper MSW v2 generics and removed unnecessary <any> type parameter
src/Umbraco.Web.UI.Client/src/mocks/handlers/user/enable.handlers.ts Added proper MSW v2 generics and fixed userIds mapping from reference objects to string IDs
src/Umbraco.Web.UI.Client/src/mocks/handlers/user/disable.handlers.ts Added proper MSW v2 generics and fixed userIds mapping from reference objects to string IDs
src/Umbraco.Web.UI.Client/src/mocks/handlers/user/current.handlers.ts Added proper MSW v2 generics and improved type safety for route params handling
src/Umbraco.Web.UI.Client/src/mocks/handlers/user/change-password.handlers.ts Added proper MSW v2 generics and reformatted for consistency
src/Umbraco.Web.UI.Client/src/mocks/handlers/telemetry.handlers.ts Added proper MSW v2 generics and safer handling of optional request body properties
src/Umbraco.Web.UI.Client/src/mocks/handlers/package.handlers.ts Added proper MSW v2 generics for create and update package handlers
src/Umbraco.Web.UI.Client/src/mocks/handlers/media-type/folder.handlers.ts Added proper MSW v2 generics and type imports for folder operations
src/Umbraco.Web.UI.Client/src/mocks/handlers/install.handlers.ts Added proper MSW v2 generics for installation endpoints
src/Umbraco.Web.UI.Client/src/mocks/handlers/health-check.handlers.ts Added proper MSW v2 generics for health check action endpoint
src/Umbraco.Web.UI.Client/src/mocks/handlers/dynamic-root.handlers.ts Removed unused type import and simplified handler without generic types
src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/folder.handlers.ts Added proper MSW v2 generics and type imports for folder operations
src/Umbraco.Web.UI.Client/src/mocks/handlers/data-type/folder.handlers.ts Added proper MSW v2 generics and type imports for folder operations
src/Umbraco.Web.UI.Client/e2e/upgrader.spec.ts Converted from MSW v1 (rest, res, ctx) to MSW v2 (http, HttpResponse) syntax
src/Umbraco.Web.UI.Client/e2e/installer.spec.ts Converted from MSW v1 (rest, res, ctx) to MSW v2 (http, HttpResponse) syntax

@nielslyngsoe nielslyngsoe merged commit 4276e90 into main Jan 9, 2026
28 checks passed
@nielslyngsoe nielslyngsoe deleted the v17/task/fix-mock-handler-typescript-errors branch January 9, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend release/no-notes Not directly part of the release (updating README, build scripts, tests, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants