UNPKG

softkave-js-utils

Version:

JavaScript & Typescript utility functions, types, and classes

8 lines (7 loc) 641 B
import { AnyFn } from '../types.js'; import { LoopAsyncSettlementType, kLoopAsyncSettlementType } from './types.js'; /** * See {@link loopAndCollate} * Returns a list containing results of `fn` invocations */ export declare function loopAndCollateAsync<TOtherParams extends unknown[], TFn extends AnyFn<[number, ...TOtherParams]>, TSettlementType extends LoopAsyncSettlementType, TResult = TSettlementType extends typeof kLoopAsyncSettlementType.allSettled ? PromiseSettledResult<Awaited<ReturnType<TFn>>>[] : Awaited<ReturnType<TFn>>[]>(fn: TFn, max: number, settlement: TSettlementType, ...otherParams: TOtherParams): Promise<TResult>;