Hook the OCPP 2.0 stack into the main code
[e-mobility-charging-stations-simulator.git] / src / charging-station / Bootstrap.ts
index 329c5546dcde0a255add2c4a136652d2b337cc61..8972119701cb9faee8206a9c2fa1d9a9e1444f36 100644 (file)
@@ -1,4 +1,4 @@
-// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+// Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
 
 import path from 'path';
 import { fileURLToPath } from 'url';
@@ -11,14 +11,15 @@ import BaseError from '../exception/BaseError';
 import type { Storage } from '../performance/storage/Storage';
 import { StorageFactory } from '../performance/storage/StorageFactory';
 import {
-  ChargingStationData,
-  ChargingStationWorkerData,
-  ChargingStationWorkerMessage,
-  ChargingStationWorkerMessageData,
+  type ChargingStationData,
+  type ChargingStationWorkerData,
+  type ChargingStationWorkerMessage,
+  type ChargingStationWorkerMessageData,
   ChargingStationWorkerMessageEvents,
 } from '../types/ChargingStationWorker';
 import type { StationTemplateUrl } from '../types/ConfigurationData';
 import type { Statistics } from '../types/Statistics';
+import type { MessageHandler } from '../types/Worker';
 import Configuration from '../utils/Configuration';
 import logger from '../utils/Logger';
 import Utils from '../utils/Utils';
@@ -178,10 +179,7 @@ export class Bootstrap {
           poolOptions: {
             workerChoiceStrategy: Configuration.getWorker().poolStrategy,
           },
-          messageHandler: this.messageHandler.bind(this) as (
-            this: Worker,
-            msg: ChargingStationWorkerMessage<ChargingStationWorkerMessageData>
-          ) => void,
+          messageHandler: this.messageHandler.bind(this) as MessageHandler<Worker>,
         }
       ));
   }