From: Jérôme Benoit Date: Fri, 21 Jul 2023 13:47:11 +0000 (+0200) Subject: fix: fix promises return type X-Git-Tag: v1.2.20~175 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=474d4ffcd45d49bb242f51510a28569b00328676;p=e-mobility-charging-stations-simulator.git fix: fix promises return type Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 383db847..78b73647 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -538,7 +538,7 @@ export const waitChargingStationEvents = async ( event: ChargingStationWorkerMessageEvents, eventsToWait: number, ): Promise => { - return new Promise((resolve) => { + return new Promise((resolve) => { let events = 0; if (eventsToWait === 0) { resolve(events); diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 4e094a21..4e456963 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -295,7 +295,7 @@ export abstract class OCPPRequestService { const self = this; // Send a message through wsConnection return promiseWithTimeout( - new Promise((resolve, reject) => { + new Promise((resolve, reject) => { /** * Function that will receive the request's response * diff --git a/src/utils/AsyncLock.ts b/src/utils/AsyncLock.ts index b396e49b..9c058456 100644 --- a/src/utils/AsyncLock.ts +++ b/src/utils/AsyncLock.ts @@ -25,7 +25,7 @@ export class AsyncLock { asyncLock.acquired = true; return; } - return new Promise((resolve) => { + return new Promise((resolve) => { asyncLock.resolveQueue.enqueue(resolve); }); } @@ -37,7 +37,7 @@ export class AsyncLock { return; } const queuedResolve = asyncLock.resolveQueue.dequeue()!; - return new Promise((resolve) => { + return new Promise((resolve) => { queuedResolve(); resolve(); }); diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 8d51349a..c2c9d0ad 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -21,7 +21,7 @@ export const validateUUID = (uuid: string): boolean => { }; export const sleep = async (milliSeconds: number): Promise => { - return new Promise((resolve) => setTimeout(resolve as () => void, milliSeconds)); + return new Promise((resolve) => setTimeout(resolve as () => void, milliSeconds)); }; export const formatDurationMilliSeconds = (duration: number): string => { diff --git a/src/worker/WorkerUtils.ts b/src/worker/WorkerUtils.ts index 368d64f2..452f8cfe 100644 --- a/src/worker/WorkerUtils.ts +++ b/src/worker/WorkerUtils.ts @@ -1,7 +1,7 @@ import chalk from 'chalk'; export const sleep = async (milliSeconds: number): Promise => { - return new Promise((resolve) => setTimeout(resolve as () => void, milliSeconds)); + return new Promise((resolve) => setTimeout(resolve as () => void, milliSeconds)); }; export const defaultExitHandler = (code: number): void => { diff --git a/ui/web/src/composables/UIClient.ts b/ui/web/src/composables/UIClient.ts index 4cdfed71..a474c8db 100644 --- a/ui/web/src/composables/UIClient.ts +++ b/ui/web/src/composables/UIClient.ts @@ -147,7 +147,7 @@ export class UIClient { ): Promise { let uuid: string; return promiseWithTimeout( - new Promise((resolve, reject) => { + new Promise((resolve, reject) => { uuid = crypto.randomUUID(); const msg = JSON.stringify([uuid, command, data]);