From 3ccfabff44dfa406a4133a6047f13637d47b52c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 21 Jan 2024 10:29:17 +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/exception/OCPPError.ts | 2 +- src/utils/Constants.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/exception/OCPPError.ts b/src/exception/OCPPError.ts index 54b80fb6..101bf5db 100644 --- a/src/exception/OCPPError.ts +++ b/src/exception/OCPPError.ts @@ -23,7 +23,7 @@ export class OCPPError extends BaseError { super(message) this.code = code - this.command = command ?? (Constants.UNKNOWN_COMMAND as RequestCommand | IncomingRequestCommand) + this.command = command ?? Constants.UNKNOWN_COMMAND this.details = details } } diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 0cfa5f99..45d86475 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -2,7 +2,9 @@ import { type AutomaticTransactionGeneratorConfiguration, type ChargingStationInfo, CurrentType, + type IncomingRequestCommand, OCPPVersion, + type RequestCommand, VendorParametersKey } from '../types/index.js' @@ -77,7 +79,7 @@ export class Constants { static readonly DEFAULT_UI_SERVER_HOST = 'localhost' static readonly DEFAULT_UI_SERVER_PORT = 8080 - static readonly UNKNOWN_COMMAND = 'unknown command' + static readonly UNKNOWN_COMMAND = 'unknown command' as RequestCommand | IncomingRequestCommand static readonly MAX_RANDOM_INTEGER = 281474976710654 -- 2.34.1