import { MaybePromise } from '../types/misc.js'; export interface AsyncPoolOptions { /** * Concurrency limit * * @default 16 */ limit?: number; /** Abort signal */ signal?: AbortSignal; /** * Customize the behavior when an error is thrown in the iterator. * * - `ignore` - Ignore the error and continue * - `collect` - Collect the error and throw it at the end in an `AggregateError` * - `throw` - Throw the error immediately, and stop any other pending tasks * * @default `() => 'throw'` */ onError?: (item: Item, index: number, error: unknown) => MaybePromise<'ignore' | 'collect' | 'throw'>; } declare class ErrorInfo { readonly item: Item; readonly index: number; readonly error: unknown; constructor(item: Item, index: number, error: unknown); } export declare class AggregateError extends Error { readonly errors: ErrorInfo[]; constructor(errors: ErrorInfo[]); } export declare function asyncPool(iterable: Iterable | AsyncIterable, executor: (item: Item, index: number) => MaybePromise, options?: AsyncPoolOptions): Promise; export declare function parallelMap(iterable: Iterable | AsyncIterable, executor: (item: Item, index: number) => MaybePromise, options?: AsyncPoolOptions): Promise; export {};