event: ChargingStationWorkerMessageEvents,
eventsToWait: number,
): Promise<number> => {
- return new Promise((resolve) => {
+ return new Promise<number>((resolve) => {
let events = 0;
if (eventsToWait === 0) {
resolve(events);
const self = this;
// Send a message through wsConnection
return promiseWithTimeout(
- new Promise((resolve, reject) => {
+ new Promise<ResponseType>((resolve, reject) => {
/**
* Function that will receive the request's response
*
asyncLock.acquired = true;
return;
}
- return new Promise((resolve) => {
+ return new Promise<void>((resolve) => {
asyncLock.resolveQueue.enqueue(resolve);
});
}
return;
}
const queuedResolve = asyncLock.resolveQueue.dequeue()!;
- return new Promise((resolve) => {
+ return new Promise<void>((resolve) => {
queuedResolve();
resolve();
});
};
export const sleep = async (milliSeconds: number): Promise<NodeJS.Timeout> => {
- return new Promise((resolve) => setTimeout(resolve as () => void, milliSeconds));
+ return new Promise<NodeJS.Timeout>((resolve) => setTimeout(resolve as () => void, milliSeconds));
};
export const formatDurationMilliSeconds = (duration: number): string => {
import chalk from 'chalk';
export const sleep = async (milliSeconds: number): Promise<NodeJS.Timeout> => {
- return new Promise((resolve) => setTimeout(resolve as () => void, milliSeconds));
+ return new Promise<NodeJS.Timeout>((resolve) => setTimeout(resolve as () => void, milliSeconds));
};
export const defaultExitHandler = (code: number): void => {
): Promise<ResponsePayload> {
let uuid: string;
return promiseWithTimeout(
- new Promise((resolve, reject) => {
+ new Promise<ResponsePayload>((resolve, reject) => {
uuid = crypto.randomUUID();
const msg = JSON.stringify([uuid, command, data]);