From: Jérôme Benoit Date: Mon, 24 Jul 2023 18:31:26 +0000 (+0200) Subject: refactor: add type for charging profiles limit X-Git-Tag: v1.2.20~156 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=947f048a4d756bbe346b943ff74cf6fb81837f9f;p=e-mobility-charging-stations-simulator.git refactor: add type for charging profiles limit Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 6a64df3d..b33a5108 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -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) {