X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPResponseService.ts;h=9daa991c952c30ff184748099dfbe158544ed8c1;hb=44ebef4c21047693fbc194aa9b7f90578465e29a;hp=b720c0f136e6c7cf0fac74de9c39b4153ee2a069;hpb=e1d9a0f4d6ff1a90048e9a694fd12b7031cc6961;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index b720c0f1..9daa991c 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -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; this.validateResponsePayload = this.validateResponsePayload.bind(this) as ( 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( chargingStation: ChargingStation, commandName: RequestCommand, - payload: JsonType, - requestPayload: JsonType, + payload: ResType, + requestPayload: ReqType, ): Promise; }