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) {