refactor: add type for charging profiles limit
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 24 Jul 2023 18:31:26 +0000 (20:31 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 24 Jul 2023 18:31:26 +0000 (20:31 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationUtils.ts

index 6a64df3d59d44d4f18cbf7880e99a090a3eeacda..b33a51083562e41668f5e441118f3da86937ae04 100644 (file)
@@ -665,24 +665,24 @@ const convertDeprecatedTemplateKey = (
   }
 };
 
+interface ChargingProfilesLimit {
+  limit: number;
+  matchingChargingProfile: ChargingProfile;
+}
+
 /**
  * Charging profiles should already be sorted by connector id and stack level (highest stack level has priority)
  *
  * @param chargingProfiles -
  * @param logPrefix -
- * @returns
+ * @returns ChargingProfilesLimit
  */
 const getLimitFromChargingProfiles = (
   chargingStation: ChargingStation,
   connectorId: number,
   chargingProfiles: ChargingProfile[],
   logPrefix: string,
-):
-  | {
-      limit: number;
-      matchingChargingProfile: ChargingProfile;
-    }
-  | undefined => {
+): ChargingProfilesLimit | undefined => {
   const debugLogMsg = `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Matching charging profile found for power limitation: %j`;
   const currentDate = new Date();
   for (const chargingProfile of chargingProfiles) {