import { Awaitable } from '../utils/Awaitable';
import type { AbortableCreator, CheckChained, Head, Last } from './Types';
export declare class Abortable<T = void> extends Awaitable<T> {
    private readonly abortController;
    constructor(callback: (resolve: (value: T) => void, reject: (reason?: Error) => void, abortController: AbortController) => void, abortController?: AbortController);
    abort(reason?: Error | undefined): void;
    static resolve(): Abortable;
    static resolve<R>(value: R): Abortable<R>;
    static reject<T>(reason?: Error): Abortable<T>;
}
export declare function linkAbortSignal<T>(abortable: Abortable<T>, abortSignal: AbortSignal): Abortable<T>;
export declare function resolveAfter<A>(abortable: Abortable<A>, what: () => void | Promise<void>): Abortable<A>;
export declare function rejectAfter<T>(abortable: Abortable<T>, what: (error: Error) => void | Promise<void>): Abortable<T>;
export declare function waitForExit<T>(abortable: Abortable<T>): Promise<void>;
export declare function abortAndWaitForExit<T>(reason: Error, abortable: Abortable<T>): Promise<void>;
export declare function map<A, B>(arr: A[], callback: (item: A) => B): Abortable<B[]>;
export declare function forEach<A>(arr: A[], callback: (a: A) => void): Abortable;
export declare function race<T>(abortables: Abortable<T>[]): Abortable<Awaited<T>>;
export declare function rightCompose<A, B>(abortSignal: AbortSignal, a: Abortable<A>, b: AbortableCreator<A, B>): Abortable<B>;
export declare function sequence<A extends readonly ((arg: any) => Abortable<unknown>)[]>(abortSignal: AbortSignal, ...creators: CheckChained<A>): (a: Parameters<Head<A>>[0]) => Abortable<Last<A>>;
export declare function isAbortable<R>(input: R | Abortable<R> | PromiseLike<R>): input is Abortable<R>;
