refactor(simulator): use generic type in OCPP payload validation code
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 7 Nov 2023 19:17:37 +0000 (20:17 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 7 Nov 2023 19:17:37 +0000 (20:17 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/OCPPResponseService.ts

index 90f92169cd4c76f8a49f37fc3635a4778689cd86..b76fde6a4b3067d907064bf46ccdb79c76e75f25 100644 (file)
@@ -72,10 +72,7 @@ export abstract class OCPPResponseService {
       return true;
     }
     if (this.jsonRequestValidateFunctions.has(commandName) === false) {
-      this.jsonRequestValidateFunctions.set(
-        commandName,
-        this.ajv.compile<JsonType>(schema).bind(this),
-      );
+      this.jsonRequestValidateFunctions.set(commandName, this.ajv.compile<T>(schema).bind(this));
     }
     const validate = this.jsonRequestValidateFunctions.get(commandName)!;
     if (validate(payload)) {