From: Jérôme Benoit Date: Sun, 21 Jan 2024 09:54:05 +0000 (+0100) Subject: refactor: type casting cleanups X-Git-Tag: v1.2.33~40 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7aba6c5335c3bac3b827f232e4df4da3ccc711a5;p=e-mobility-charging-stations-simulator.git refactor: type casting cleanups Signed-off-by: Jérôme Benoit --- 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