export declare class Task<T> implements PromiseLike<T> {
    private _state;
    private _value;
    private _reason;
    private _promise;
    constructor(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void);
    static attempt<T>(myFunction: () => T | Task<T>): Task<T>;
    /**
     * Creates a Task that is resolved or rejected when any of the provided Tasks are resolved
     * or rejected.
     * @param values An array of Tasks.
     * @returns A new Task.
     */
    static race<T>(values: readonly (T | PromiseLike<T>)[]): Task<T>;
    /**
     * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
     * resolved value cannot be modified from the callback.
     *
     * This polyfill is based on a Stack Overflow answer:
     * https://stackoverflow.com/a/53327815/5322405
     * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
     * @returns A Promise for the completion of the callback.
     */
    finally(onfinally?: (() => void) | undefined | null): Task<T>;
    then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Task<TResult1 | TResult2>;
    /**
     * Returns `true` if the task succeeded, `false` otherwise.
     */
    isFulfilled(): boolean;
    /**
     * Returns `true` if the task is still running, `false` otherwise.
     */
    isPending(): boolean;
    /**
     * Returns `true` if the task failed, `false` otherwise.
     */
    isRejected(): boolean;
    /**
     * Returns `true` if the task's fate has been decided one way or the other.
     * It is no longer pending.
     */
    isResolved(): boolean;
    /**
     * Returns the failure object (if any) if the task is rejected.
     * Otherwise throws an error. Call the `isRejected()` method to confirm
     * that a Task failed prior to calling this method.
     */
    reason(): any;
    /**
     * Returns the value (if any) if the task is resolved.
     * Otherwise throws an error. Call the `isResolved()` method to confirm
     * that a Task succeeded prior to calling this method.
     */
    value(): T;
}
