Simplify WorkerUtils.defaultErrorHandler usage in WorkerSet
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationWorker.ts
index 2fd83728d9ff3cb0e8fb1d0bcdff24069946e29a..4f109bf5023206c826e55f880c278d576ccaafa3 100644 (file)
@@ -24,7 +24,7 @@ if (ChargingStationUtils.workerPoolInUse()) {
 } else {
   // Add message listener to start charging station from main thread
   addMessageListener();
-  if (!Utils.isUndefined(workerData)) {
+  if (Utils.isUndefined(workerData) === false) {
     startChargingStation(workerData as ChargingStationWorkerData);
   }
 }
@@ -33,7 +33,7 @@ if (ChargingStationUtils.workerPoolInUse()) {
  * Listen messages send by the main thread
  */
 function addMessageListener(): void {
-  parentPort?.on('message', (message: ChargingStationWorkerMessage) => {
+  parentPort?.on('message', (message: ChargingStationWorkerMessage<ChargingStationWorkerData>) => {
     if (message.id === ChargingStationWorkerMessageEvents.START_WORKER_ELEMENT) {
       startChargingStation(message.data);
     }