From a75f9b67b28dfcd5e8c1694cf48ff387b423aa70 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Wed, 20 May 2026 15:37:52 -0700 Subject: [PATCH] chore(superset-ui-switchboard): forward-compat fixes for TypeScript 6.0 (Phase E) (#40028) Co-authored-by: Claude Co-authored-by: Claude Opus 4.7 --- .../superset-ui-switchboard/src/switchboard.test.ts | 7 +++++-- .../packages/superset-ui-switchboard/src/switchboard.ts | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts b/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts index 5bfe77903ff..352c508b2e8 100644 --- a/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts +++ b/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts @@ -95,8 +95,11 @@ class FakeMessageChannel { const port2 = new FakeMessagePort(); port1.otherPort = port2; port2.otherPort = port1; - this.port1 = port1; - this.port2 = port2; + // FakeMessagePort only implements the subset of MessagePort that + // Switchboard exercises; cast at the boundary so the fake satisfies + // the consumer signature without weakening the production type. + this.port1 = port1 as unknown as MessagePort; + this.port2 = port2 as unknown as MessagePort; } } diff --git a/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts b/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts index d1df6136a50..46af6fb4d3e 100644 --- a/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts +++ b/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts @@ -88,7 +88,7 @@ function isError(message: Message): message is ErrorMessage { * Calling methods on the switchboard causes messages to be sent through the channel. */ export class Switchboard { - port: MessagePort; + port!: MessagePort; name = ''; @@ -97,9 +97,9 @@ export class Switchboard { // used to make unique ids incrementor = 1; - debugMode: boolean; + debugMode = false; - private isInitialised: boolean; + private isInitialised = false; constructor(params?: Params) { if (!params) {