X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fbroadcast-channel%2FChargingStationWorkerBroadcastChannel.ts;h=10d0c75c3aff0ad88776f0d76a2fb80cca665c5e;hb=3000c1258ccda0c8828f4e4fffb988e5ffaa84da;hp=c464f9ca11d33222925f2ee0bf52c19fa37f8948;hpb=4b9332afad3ebdd1c7b7e3e98dc1a9fcefebc04f;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts index c464f9ca..10d0c75c 100644 --- a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts @@ -285,8 +285,6 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne return } let responsePayload: BroadcastChannelResponsePayload | undefined - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - let commandResponse: CommandResponse | void this.commandHandler(command, requestPayload) .then(commandResponse => { if (commandResponse == null || isEmptyObject(commandResponse)) { @@ -312,12 +310,10 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne status: ResponseStatus.FAILURE, command, requestPayload, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - commandResponse: commandResponse!, errorMessage: (error as OCPPError).message, errorStack: (error as OCPPError).stack, errorDetails: (error as OCPPError).details - } + } satisfies BroadcastChannelResponsePayload }) .finally(() => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -345,7 +341,10 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne return await commandHandler(requestPayload) } return ( - commandHandler as (requestPayload?: BroadcastChannelRequestPayload) => CommandResponse + commandHandler as ( + requestPayload?: BroadcastChannelRequestPayload + // eslint-disable-next-line @typescript-eslint/no-invalid-void-type + ) => CommandResponse | void )(requestPayload) } throw new BaseError(`Unknown worker broadcast channel command: '${command}'`)