X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationUtils.ts;h=78b73647456bdf8568ebf61aaac281e698aad322;hb=704426f31f79f227c2e4163fb8937f89859effb5;hp=4fdfe230a38360b5917f3d8627bdcb9860ea66d9;hpb=e1d9a0f4d6ff1a90048e9a694fd12b7031cc6961;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 4fdfe230..78b73647 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -538,7 +538,7 @@ export const waitChargingStationEvents = async ( event: ChargingStationWorkerMessageEvents, eventsToWait: number, ): Promise => { - return new Promise((resolve) => { + return new Promise((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)[key!] = + template[deprecatedKey as keyof ChargingStationTemplate]; } - delete template[deprecatedKey]; + delete template[deprecatedKey as keyof ChargingStationTemplate]; } };