From: Jérôme Benoit Date: Sun, 10 Mar 2024 16:25:42 +0000 (+0100) Subject: refactor: cleanup some type casting X-Git-Tag: v1.3.0~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=61877a2e1a2cf976a5e5f7f37828950d8aca9af5;p=e-mobility-charging-stations-simulator.git refactor: cleanup some type casting Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index 204b5431..6aed70a1 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -4,6 +4,7 @@ import { type BroadcastChannelRequestPayload, type ChargingStationOptions, ConfigurationSection, + type JsonObject, type JsonType, ProcedureName, type ProtocolRequest, @@ -326,7 +327,7 @@ export abstract class AbstractUIService { try { return { status: ResponseStatus.SUCCESS, - state: Bootstrap.getInstance().getState() + state: Bootstrap.getInstance().getState() as unknown as JsonObject } satisfies ResponsePayload } catch (error) { return { diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 32bac44d..4c4c20f2 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -316,13 +316,13 @@ export const JSONStringify = < if (value instanceof Map) { switch (mapFormat) { case MapStringifyFormat.object: - return { ...Object.fromEntries>(value.entries()) } + return { ...Object.fromEntries>>(value.entries()) } case MapStringifyFormat.array: default: return [...value] } } else if (value instanceof Set) { - return [...value] as unknown[] + return [...value] as JsonType[] } return value },