build: rollup -> esbuild
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPResponseService.ts
index b720c0f136e6c7cf0fac74de9c39b4153ee2a069..9daa991c952c30ff184748099dfbe158544ed8c1 100644 (file)
@@ -31,11 +31,14 @@ export abstract class OCPPResponseService {
       multipleOfPrecision: 2,
     });
     ajvFormats(this.ajv);
-    this.responseHandler = this.responseHandler.bind(this) as (
+    this.responseHandler = this.responseHandler.bind(this) as <
+      ReqType extends JsonType,
+      ResType extends JsonType,
+    >(
       chargingStation: ChargingStation,
       commandName: RequestCommand,
-      payload: JsonType,
-      requestPayload: JsonType,
+      payload: ResType,
+      requestPayload: ReqType,
     ) => Promise<void>;
     this.validateResponsePayload = this.validateResponsePayload.bind(this) as <T extends JsonType>(
       chargingStation: ChargingStation,
@@ -73,7 +76,7 @@ export abstract class OCPPResponseService {
       OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!),
       'Response PDU is invalid',
       commandName,
-      JSON.stringify(validate.errors, null, 2),
+      JSON.stringify(validate.errors, undefined, 2),
     );
   }
 
@@ -81,10 +84,10 @@ export abstract class OCPPResponseService {
     /* This is intentional */
   }
 
-  public abstract responseHandler(
+  public abstract responseHandler<ReqType extends JsonType, ResType extends JsonType>(
     chargingStation: ChargingStation,
     commandName: RequestCommand,
-    payload: JsonType,
-    requestPayload: JsonType,
+    payload: ResType,
+    requestPayload: ReqType,
   ): Promise<void>;
 }