Apply dependencies update
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationWorkerBroadcastChannel.ts
index 08126286b15d5cbe6ed378e9c41045232347fb76..e36650bb3cb2ab1c4d2281e8bbd0dc2ac0cb7f63 100644 (file)
@@ -34,21 +34,22 @@ type CommandResponse =
   | StatusNotificationResponse
   | HeartbeatResponse;
 
+type CommandHandler = (
+  requestPayload?: BroadcastChannelRequestPayload
+) => Promise<CommandResponse | void> | void;
+
 export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChannel {
-  private readonly commandHandlers: Map<
-    BroadcastChannelProcedureName,
-    (requestPayload?: BroadcastChannelRequestPayload) => Promise<CommandResponse> | void
-  >;
+  private readonly commandHandlers: Map<BroadcastChannelProcedureName, CommandHandler>;
 
   private readonly chargingStation: ChargingStation;
 
   constructor(chargingStation: ChargingStation) {
     super();
-    this.commandHandlers = new Map([
+    this.commandHandlers = new Map<BroadcastChannelProcedureName, CommandHandler>([
       [BroadcastChannelProcedureName.START_CHARGING_STATION, () => this.chargingStation.start()],
       [
         BroadcastChannelProcedureName.STOP_CHARGING_STATION,
-        async () => await this.chargingStation.stop(),
+        async () => this.chargingStation.stop(),
       ],
       [
         BroadcastChannelProcedureName.OPEN_CONNECTION,