build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationUtils.ts
index 4fdfe230a38360b5917f3d8627bdcb9860ea66d9..78b73647456bdf8568ebf61aaac281e698aad322 100644 (file)
@@ -538,7 +538,7 @@ export const waitChargingStationEvents = async (
   event: ChargingStationWorkerMessageEvents,
   eventsToWait: number,
 ): Promise<number> => {
-  return new Promise((resolve) => {
+  return new Promise<number>((resolve) => {
     let events = 0;
     if (eventsToWait === 0) {
       resolve(events);
@@ -565,7 +565,6 @@ const getConfiguredNumberOfConnectors = (stationTemplate: ChargingStationTemplat
       ? getMaxNumberOfConnectors(stationTemplate.Connectors) - 1
       : getMaxNumberOfConnectors(stationTemplate.Connectors);
   } else if (stationTemplate.Evses && !stationTemplate.Connectors) {
-    configuredMaxConnectors = 0;
     for (const evse in stationTemplate.Evses) {
       if (evse === '0') {
         continue;
@@ -624,7 +623,7 @@ const warnDeprecatedTemplateKey = (
   templateFile: string,
   logMsgToAppend = '',
 ): void => {
-  if (!isUndefined(template[key])) {
+  if (!isUndefined(template[key as keyof ChargingStationTemplate])) {
     const logMsg = `Deprecated template key '${key}' usage in file '${templateFile}'${
       isNotEmptyString(logMsgToAppend) ? `. ${logMsgToAppend}` : ''
     }`;
@@ -638,11 +637,12 @@ const convertDeprecatedTemplateKey = (
   deprecatedKey: string,
   key?: string,
 ): void => {
-  if (!isUndefined(template[deprecatedKey])) {
+  if (!isUndefined(template[deprecatedKey as keyof ChargingStationTemplate])) {
     if (!isUndefined(key)) {
-      template[key!] = template[deprecatedKey] as unknown;
+      (template as unknown as Record<string, unknown>)[key!] =
+        template[deprecatedKey as keyof ChargingStationTemplate];
     }
-    delete template[deprecatedKey];
+    delete template[deprecatedKey as keyof ChargingStationTemplate];
   }
 };