2023-02-13 11:38:37 +01:00

20 lines
528 B
TypeScript

export type MapAsync<T = any, R = any> = lodash.CurriedFunction3<
T[],
(element: T, index: number) => R | Promise<R>,
{ concurrency?: number },
Promise<R[]>
>;
export type ForEachAsync<T = any, R = any> = (
array: T[],
func: (element: T, index: number) => R | Promise<R>,
options?: { concurrency?: number }
) => Promise<R[]>;
export type ReduceAsync<T = any, V = T, R = V> = lodash.CurriedFunction3<
T[],
(accumulator: V | R, current: Awaited<T>, index: number) => R | Promise<R>,
V,
Promise<R>
>;