fix: move and fix statistic related helpers implementation
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationUtils.ts
index 4084a484864006c46d964c6e895751a2da57cb97..d8f67c21460b626875d01be4bae961e93d1c3b78 100644 (file)
@@ -389,7 +389,7 @@ export class ChargingStationUtils {
   public static stationTemplateToStationInfo(
     stationTemplate: ChargingStationTemplate
   ): ChargingStationInfo {
-    stationTemplate = Utils.cloneObject(stationTemplate);
+    stationTemplate = Utils.cloneObject<ChargingStationTemplate>(stationTemplate);
     delete stationTemplate.power;
     delete stationTemplate.powerUnit;
     delete stationTemplate?.Connectors;
@@ -471,15 +471,15 @@ export class ChargingStationUtils {
     let limit: number, matchingChargingProfile: ChargingProfile;
     // Get charging profiles for connector and sort by stack level
     const chargingProfiles =
-      Utils.cloneObject(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles)?.sort(
-        (a, b) => b.stackLevel - a.stackLevel
-      ) ?? [];
+      Utils.cloneObject<ChargingProfile[]>(
+        chargingStation.getConnectorStatus(connectorId)?.chargingProfiles
+      )?.sort((a, b) => b.stackLevel - a.stackLevel) ?? [];
     // Get profiles on connector 0
     if (chargingStation.getConnectorStatus(0)?.chargingProfiles) {
       chargingProfiles.push(
-        ...Utils.cloneObject(chargingStation.getConnectorStatus(0).chargingProfiles).sort(
-          (a, b) => b.stackLevel - a.stackLevel
-        )
+        ...Utils.cloneObject<ChargingProfile[]>(
+          chargingStation.getConnectorStatus(0).chargingProfiles
+        ).sort((a, b) => b.stackLevel - a.stackLevel)
       );
     }
     if (Utils.isNotEmptyArray(chargingProfiles)) {