type MatchArgs<T, U> = {
    Loaded: (data: T) => U;
    NotLoaded: () => U;
    Failed: (e: Error) => U;
} | {
    Loaded: (data: T) => U;
    NotLoaded: () => U;
    _: () => U;
} | {
    Loaded: (data: T) => U;
    Failed: (e: Error) => U;
    _: () => U;
} | {
    NotLoaded: () => U;
    Failed: (e: Error) => U;
    _: () => U;
} | {
    Loaded: (data: T) => U;
    _: () => U;
} | {
    NotLoaded: () => U;
    _: () => U;
} | {
    Failed: (e: Error) => U;
    _: () => U;
};
declare class Loadable_<T> {
    _tag: 'Loaded' | 'NotLoaded' | 'Failed';
    data: T | undefined;
    error: Error | undefined;
    constructor(tag: 'Loaded' | 'NotLoaded' | 'Failed', data: T | undefined, error?: Error | undefined);
    /**
     * The map() function creates a new Loadable with the result of calling
     * the provided function on the contained value in the passed Loadable.
     *
     * If the passed Loadable is NotLoaded then the return value is NotLoaded
     */
    map<U>(fn: (t: T) => U): Loadable<U>;
    static map<T, U>(l: Loadable<T>, fn: (_: T) => U): Loadable<U>;
    /**
     * The flatMap() function creates a new Loadable with the result of calling
     * the provided function on the contained value in the passed Loadable and then
     * flattening the result.
     *
     * If any of the passed or returned Loadables is NotLoaded, the result is NotLoaded.
     */
    flatMap<U>(fn: (_: T) => Loadable<U>): Loadable<U>;
    static flatMap<T, U>(l: Loadable<T>, fn: (_: T) => Loadable<U>): Loadable<U>;
    /**
     * Performs a side-effecting function if the passed Loadable is Loaded.
     */
    forEach<U>(fn: (_: T) => U): void;
    static forEach<T, U>(l: Loadable<T>, fn: (_: T) => U): void;
    /**
     * If the passed Loadable is Loaded this returns the data, otherwise
     * it returns the default value.
     */
    getOrElse(def: T): T;
    static getOrElse<T>(def: T, l: Loadable<T>): T;
    /**
     * Allows you to match out the cases in the Loadable with named
     * arguments.
     */
    match<U>(cases: MatchArgs<T, U>): U;
    static match<T, U>(l: Loadable<T>, cases: MatchArgs<T, U>): U;
    /** Like `match` but without argument names */
    quickMatch<U>(nl: U, fd: U, f: (data: T) => U): U;
    static quickMatch<T, U>(l: Loadable<T>, nl: U, fd: U, f: (data: T) => U): U;
    /**
     * Groups up all passed Loadables. Failed takes priority over
     * NotLoaded so all([NotLoaded, Failed, Loaded(4)]) returns Failed
     */
    static all<A>(ls: [Loadable<A>]): Loadable<[A]>;
    static all<A, B>(ls: [Loadable<A>, Loadable<B>]): Loadable<[A, B]>;
    static all<A, B, C>(ls: [Loadable<A>, Loadable<B>, Loadable<C>]): Loadable<[A, B, C]>;
    static all<A, B, C, D>(ls: [Loadable<A>, Loadable<B>, Loadable<C>, Loadable<D>]): Loadable<[A, B, C, D]>;
    static all<A, B, C, D, E>(ls: [Loadable<A>, Loadable<B>, Loadable<C>, Loadable<D>, Loadable<E>]): Loadable<[A, B, C, D, E]>;
    static all<T>(ls: Array<Loadable<T>>): Loadable<Array<T>>;
    /**
     * Filters an array of Loadables to remove NotLoaded values and returns array of data.
     * Can also optionally accept a conditional function.
     */
    static filterNotLoaded<T>(a: Array<Loadable<T>>, conditionFn?: (d: T, i?: number) => boolean): Array<T>;
    /** Allows you to use Loadables with React's Suspense component */
    waitFor(): T;
    static waitFor<T>(l: Loadable<T>): T;
    get isLoaded(): boolean;
    static isLoaded<T>(l: Loadable<T>): l is {
        _tag: 'Loaded';
        data: T;
        isLoaded: true;
        isNotLoaded: false;
        isFailed: false;
    } & Omit<Loadable_<T>, 'isLoaded' | 'data'>;
    get isNotLoaded(): boolean;
    static isNotLoaded<T>(l: Loadable<T>): l is {
        _tag: 'NotLoaded';
        isLoaded: false;
        isNotLoaded: true;
        isFailed: false;
    } & Omit<Loadable_<T>, 'isNotLoaded' | 'data'>;
    get isFailed(): boolean;
    static isFailed<T>(l: Loadable<T>): l is {
        _tag: 'Failed';
        isLoaded: false;
        isNotLoaded: false;
        isFailed: true;
    } & Omit<Loadable_<T>, 'isFailed' | 'data'>;
    /** Returns true if the passed object is a Loadable */
    static isLoadable<T, Z>(l: Loadable<T> | Z): l is Loadable<T>;
    /** If passed a Loadable, returns unchanged. Otherwise, wraps argument in Loaded */
    static ensureLoadable<T>(l: Loadable<T> | T): Loadable<T>;
}
export type Loadable<T> = ({
    _tag: 'Loaded';
    data: T;
    isLoaded: true;
    isNotLoaded: false;
    isFailed: false;
} & Omit<Loadable_<T>, '_tag' | 'isLoaded' | 'isNotLoaded' | 'isFailed' | 'data'>) | ({
    _tag: 'NotLoaded';
    isLoaded: false;
    isNotLoaded: true;
    isFailed: false;
} & Omit<Loadable_<T>, '_tag' | 'isLoaded' | 'isNotLoaded' | 'isFailed' | 'data'>) | ({
    _tag: 'Failed';
    isLoaded: false;
    isNotLoaded: false;
    isFailed: true;
} & Omit<Loadable_<T>, '_tag' | 'isLoaded' | 'isNotLoaded' | 'isFailed' | 'data'>);
declare const Loaded: <T>(data: T) => Loadable<T>;
declare const NotLoaded: Loadable<never>;
declare const Failed: <T>(error: Error) => Loadable<T>;
export declare const Loadable: typeof Loadable_;
export { Loaded, NotLoaded, Failed };
//# sourceMappingURL=loadable.d.ts.map