refactor: cleanup unneeded type casting
[e-mobility-charging-stations-simulator.git] / src / charging-station / IdTagsCache.ts
index b50c062008b9b1388d9ea21cfeb21ac3ba0018ce..d1ad32d2bbffe63aa4d091fe11fecce1af0db165 100644 (file)
@@ -48,9 +48,10 @@ export class IdTagsCache {
     chargingStation: ChargingStation,
     connectorId: number
   ): string {
-    const hashId = chargingStation.stationInfo.hashId
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-    const idTagsFile = getIdTagsFile(chargingStation.stationInfo)!
+    const hashId = chargingStation.stationInfo!.hashId
+    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+    const idTagsFile = getIdTagsFile(chargingStation.stationInfo!)!
     switch (distribution) {
       case IdTagDistribution.RANDOM:
         return this.getRandomIdTag(hashId, idTagsFile)
@@ -108,12 +109,13 @@ export class IdTagsCache {
 
   private getConnectorAffinityIdTag (chargingStation: ChargingStation, connectorId: number): string {
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-    const file = getIdTagsFile(chargingStation.stationInfo)!
+    const file = getIdTagsFile(chargingStation.stationInfo!)!
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const idTags = this.getIdTags(file)!
     const addressableKey = this.getIdTagsCacheIndexesAddressableKey(
       file,
-      chargingStation.stationInfo.hashId
+      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+      chargingStation.stationInfo!.hashId
     )
     this.idTagsCachesAddressableIndexes.set(
       addressableKey,
@@ -176,7 +178,7 @@ export class IdTagsCache {
         deleted.push(this.idTagsCachesAddressableIndexes.delete(key))
       }
     }
-    return !deleted.some((value) => !value)
+    return !deleted.some(value => !value)
   }
 
   private getIdTagsCacheIndexesAddressableKey (prefix: string, uid: string): string {