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