From: Jérôme Benoit Date: Sun, 29 Aug 2021 17:07:07 +0000 (+0200) Subject: Revert wrong any type removal X-Git-Tag: v1.0.52~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5842a02d275889a96eda8727a7f3d0f7e60bf357;p=e-mobility-charging-stations-simulator.git Revert wrong any type removal Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 5d4883ec..171d8a3c 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -23,8 +23,7 @@ export default abstract class OCPPRequestService { this.ocppResponseService = ocppResponseService; } - public async sendMessage(messageId: string, commandParams: Record, messageType: MessageType, - commandName: RequestCommand | IncomingRequestCommand): Promise { + public async sendMessage(messageId: string, commandParams: any, messageType: MessageType, commandName: RequestCommand | IncomingRequestCommand): Promise { // eslint-disable-next-line @typescript-eslint/no-this-alias const self = this; // Send a message through wsConnection @@ -35,7 +34,7 @@ export default abstract class OCPPRequestService { // Request case MessageType.CALL_MESSAGE: // Build request - this.chargingStation.requests[messageId] = [responseCallback, rejectCallback, commandParams]; + this.chargingStation.requests[messageId] = [responseCallback, rejectCallback, commandParams as Record]; messageToSend = JSON.stringify([messageType, messageId, commandName, commandParams]); break; // Response @@ -62,7 +61,7 @@ export default abstract class OCPPRequestService { // Buffer it this.chargingStation.addToMessageQueue(messageToSend); // Reject it - return rejectCallback(new OCPPError(commandParams.code ? commandParams.code as ErrorType : ErrorType.GENERIC_ERROR, commandParams.message ? commandParams.message as string : `WebSocket closed for message id '${messageId}' with content '${messageToSend}', message buffered`, commandParams.details ? commandParams.details : {})); + return rejectCallback(new OCPPError(commandParams.code ? commandParams.code : ErrorType.GENERIC_ERROR, commandParams.message ? commandParams.message : `WebSocket closed for message id '${messageId}' with content '${messageToSend}', message buffered`, commandParams.details ? commandParams.details : {})); } // Response? if (messageType === MessageType.CALL_RESULT_MESSAGE) { @@ -70,7 +69,7 @@ export default abstract class OCPPRequestService { resolve(); } else if (messageType === MessageType.CALL_ERROR_MESSAGE) { // Send timeout - setTimeout(() => rejectCallback(new OCPPError(commandParams.code ? commandParams.code as ErrorType : ErrorType.GENERIC_ERROR, commandParams.message ? commandParams.message as string : `Timeout for message id '${messageId}' with content '${messageToSend}'`, commandParams.details ? commandParams.details : {})), Constants.OCPP_ERROR_TIMEOUT); + setTimeout(() => rejectCallback(new OCPPError(commandParams.code ? commandParams.code : ErrorType.GENERIC_ERROR, commandParams.message ? commandParams.message : `Timeout for message id '${messageId}' with content '${messageToSend}'`, commandParams.details ? commandParams.details : {})), Constants.OCPP_ERROR_TIMEOUT); } /**