X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationUtils.ts;h=383db84780f53aa22bb415ba7b3603e6b32bea2f;hb=8cc482a9324a0989516b6eb6db85a16258c4b4d1;hp=0fae41f7ddd259b209d7d1a8132e3a00a8f9dbb7;hpb=f568f36861d62d759a95b17fbe10380eca88a71b;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 0fae41f7..383db847 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -623,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}` : '' }`; @@ -637,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]; } };