refactor(simulator): remove unneeded type casting
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 15 Mar 2023 21:46:18 +0000 (22:46 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 15 Mar 2023 21:46:18 +0000 (22:46 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16RequestService.ts
src/charging-station/ocpp/2.0/OCPP20RequestService.ts
src/utils/Configuration.ts

index 645c3f736b004be126891afc3f8bb8b2318c85dc..ac5aaa93c451d8c877c9d93b0345550b74dd37e8 100644 (file)
@@ -1510,7 +1510,7 @@ export class ChargingStation {
         messageType
       )} is not an array`,
       undefined,
-      cachedRequest as unknown as JsonType
+      cachedRequest as JsonType
     );
   }
 
index b4585598415d57c88c2a3a1a41cb402292bdae72..1d571b042dfdedecab3add913269c88171714926 100644 (file)
@@ -138,7 +138,7 @@ export class OCPP16RequestService extends OCPPRequestService {
         this.buildRequestPayload<RequestType>(chargingStation, commandName, commandParams),
         commandName,
         params
-      )) as unknown as ResponseType;
+      )) as ResponseType;
     }
     // OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError().
     throw new OCPPError(
index 16eef116a37d5a9af9307db3690abf47623f77fb..92d70aedcb2c63a569a5d35adf409de1a34424a8 100644 (file)
@@ -75,7 +75,7 @@ export class OCPP20RequestService extends OCPPRequestService {
         this.buildRequestPayload<RequestType>(chargingStation, commandName, commandParams),
         commandName,
         params
-      )) as unknown as ResponseType;
+      )) as ResponseType;
     }
     // OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError().
     throw new OCPPError(
index 36b4e362a565f3f998df78cd01d73da56e0a5b96..7d5b217d5faafa331c8b16ae4768e65003e9c691 100644 (file)
@@ -128,7 +128,7 @@ export class Configuration {
     !Utils.isUndefined(Configuration.getConfig()['stationTemplateURLs']) &&
       (Configuration.getConfig().stationTemplateUrls = Configuration.getConfig()[
         'stationTemplateURLs'
-      ] as unknown as StationTemplateUrl[]);
+      ] as StationTemplateUrl[]);
     Configuration.getConfig().stationTemplateUrls.forEach((stationUrl: StationTemplateUrl) => {
       if (!Utils.isUndefined(stationUrl['numberOfStation'])) {
         console.error(