From 7aba6c5335c3bac3b827f232e4df4da3ccc711a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 21 Jan 2024 10:54:05 +0100 Subject: [PATCH] refactor: type casting cleanups MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ocpp/OCPPRequestService.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index a56f1ac6..c20a1d38 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -458,9 +458,9 @@ export abstract class OCPPRequestService { messageToSend = JSON.stringify([ messageType, messageId, - commandName, - messagePayload - ] as OutgoingRequest) + commandName as RequestCommand, + messagePayload as JsonType + ] satisfies OutgoingRequest) break // Response case MessageType.CALL_RESULT_MESSAGE: @@ -470,7 +470,11 @@ export abstract class OCPPRequestService { commandName, messagePayload as JsonType ) - messageToSend = JSON.stringify([messageType, messageId, messagePayload] as Response) + messageToSend = JSON.stringify([ + messageType, + messageId, + messagePayload as JsonType + ] satisfies Response) break // Error Message case MessageType.CALL_ERROR_MESSAGE: @@ -483,7 +487,7 @@ export abstract class OCPPRequestService { (messagePayload as OCPPError).details ?? { command: (messagePayload as OCPPError).command ?? commandName } - ] as ErrorResponse) + ] satisfies ErrorResponse) break } return messageToSend -- 2.34.1