build: rollup -> esbuild
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPIncomingRequestService.ts
index 0ea55a63515f0f479a627299625c1703e5442c15..85fd88e70ebaa624ef454a80493e52cc1dd8f748 100644 (file)
@@ -33,11 +33,15 @@ export abstract class OCPPIncomingRequestService extends AsyncResource {
       multipleOfPrecision: 2,
     });
     ajvFormats(this.ajv);
-    this.incomingRequestHandler = this.incomingRequestHandler.bind(this) as (
+    this.incomingRequestHandler = this.incomingRequestHandler.bind(this) as <
+      ReqType extends JsonType,
+      // eslint-disable-next-line @typescript-eslint/no-unused-vars
+      ResType extends JsonType,
+    >(
       chargingStation: ChargingStation,
       messageId: string,
       commandName: IncomingRequestCommand,
-      commandPayload: JsonType,
+      commandPayload: ReqType,
     ) => Promise<void>;
     this.validateIncomingRequestPayload = this.validateIncomingRequestPayload.bind(this) as <
       T extends JsonType,
@@ -99,7 +103,7 @@ export abstract class OCPPIncomingRequestService extends AsyncResource {
       OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!),
       'Incoming request PDU is invalid',
       commandName,
-      JSON.stringify(validate.errors, null, 2),
+      JSON.stringify(validate.errors, undefined, 2),
     );
   }
 
@@ -110,10 +114,11 @@ export abstract class OCPPIncomingRequestService extends AsyncResource {
     return OCPPConstants.OCPP_RESPONSE_REJECTED;
   }
 
-  public abstract incomingRequestHandler(
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
+  public abstract incomingRequestHandler<ReqType extends JsonType, ResType extends JsonType>(
     chargingStation: ChargingStation,
     messageId: string,
     commandName: IncomingRequestCommand,
-    commandPayload: JsonType,
+    commandPayload: ReqType,
   ): Promise<void>;
 }