From: Jérôme Benoit Date: Tue, 19 Mar 2024 19:53:00 +0000 (+0100) Subject: refactor: strong stype configuration key deprecation helper X-Git-Tag: v1.3.1~27 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=23c97c471a4b7194aaac0620e935341de07eb1ad;p=e-mobility-charging-stations-simulator.git refactor: strong stype configuration key deprecation helper Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index e1fd11c7..9356785d 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -513,22 +513,22 @@ export class Configuration { private static warnDeprecatedConfigurationKey ( key: string, - sectionName?: string, + configurationSection?: ConfigurationSection, logMsgToAppend = '' ): void { if ( - sectionName != null && - Configuration.getConfigurationData()?.[sectionName as keyof ConfigurationData] != null && + configurationSection != null && + Configuration.getConfigurationData()?.[configurationSection as keyof ConfigurationData] != + null && ( - Configuration.getConfigurationData()?.[sectionName as keyof ConfigurationData] as Record< - string, - unknown - > + Configuration.getConfigurationData()?.[ + configurationSection as keyof ConfigurationData + ] as Record )[key] != null ) { console.error( `${chalk.green(logPrefix())} ${chalk.red( - `Deprecated configuration key '${key}' usage in section '${sectionName}'${ + `Deprecated configuration key '${key}' usage in section '${configurationSection}'${ logMsgToAppend.trim().length > 0 ? `. ${logMsgToAppend}` : '' }` )}`