export type ErrorType = Error | string; export type Continuation = (err?: E | null) => void; export type AsyncCompletionCallback = (err?: E) => void; export type ContinuationWithResult = (err?: E | null, result?: R) => void; export type AsyncResultArrayCallback = (err?: E | null, result?: Array) => void; export type AsyncIterator = (item: T, next: ContinuationWithResult, index: number) => void; export type AsyncFunction = (callback: Continuation) => void; export function asyncSeries(tasks: AsyncFunction[], done: AsyncCompletionCallback): void; export function asyncParallelLimit( tasks: AsyncFunction[], limit: number, done: AsyncCompletionCallback, ): void; export function asyncParallel( tasks: AsyncFunction[], done: AsyncCompletionCallback, ): void; export function asyncEachLimit( arr: Array, limit: number, proc: AsyncIterator, done: AsyncResultArrayCallback, ): void; export function asyncEach( arr: Array, proc: AsyncIterator, done: AsyncResultArrayCallback, ): void; export function asyncEachSeries( arr: Array, proc: AsyncIterator, done: AsyncResultArrayCallback, ): void; export type ContinuationVArg = (err?: E | null, ...args: V) => void; export type AsyncVArgFunction = (done: ContinuationVArg) => void; export type LimitedRun = ( task: AsyncVArgFunction, done?: ContinuationVArg ) => void; export function asyncLimiter( limit: number ): LimitedRun;