) => boolean;
}
- public async incomingRequestHandler(
+ public async incomingRequestHandler<ReqType extends JsonType, ResType extends JsonType>(
chargingStation: ChargingStation,
messageId: string,
commandName: OCPP20IncomingRequestCommand,
- commandPayload: JsonType,
+ commandPayload: ReqType,
): Promise<void> {
- let response: JsonType;
+ let response: ResType;
if (
chargingStation.getOcppStrictCompliance() === true &&
chargingStation.inPendingState() === true &&
try {
this.validatePayload(chargingStation, commandName, commandPayload);
// Call the method to build the response
- response = await this.incomingRequestHandlers.get(commandName)!(
+ response = (await this.incomingRequestHandlers.get(commandName)!(
chargingStation,
commandPayload,
- );
+ )) as ResType;
} catch (error) {
// Log
logger.error(