import { DisposableStore } from '../../lifecycle';
import { IObservable } from '../base';
export declare class ObservableLazy<T> {
    private readonly _computeValue;
    private readonly _value;
    /**
     * The cached value.
     * Does not force a computation of the value.
     */
    get cachedValue(): IObservable<T | undefined>;
    constructor(_computeValue: () => T);
    /**
     * Returns the cached value.
     * Computes the value if the value has not been cached yet.
     */
    getValue(): T;
}
/**
 * A promise whose state is observable.
 */
export declare class ObservablePromise<T> {
    static fromFn<T>(fn: () => Promise<T>): ObservablePromise<T>;
    static resolved<T>(value: T): ObservablePromise<T>;
    private readonly _value;
    /**
     * The promise that this object wraps.
     */
    readonly promise: Promise<T>;
    /**
     * The current state of the promise.
     * Is `undefined` if the promise didn't resolve yet.
     */
    readonly promiseResult: IObservable<PromiseResult<T> | undefined>;
    constructor(promise: Promise<T>);
    readonly resolvedValue: import("../base").IObservableWithChange<T | undefined, void>;
}
export declare class PromiseResult<T> {
    /**
     * The value of the resolved promise.
     * Undefined if the promise rejected.
     */
    readonly data: T | undefined;
    /**
     * The error in case of a rejected promise.
     * Undefined if the promise resolved.
     */
    readonly error: unknown | undefined;
    constructor(
    /**
     * The value of the resolved promise.
     * Undefined if the promise rejected.
     */
    data: T | undefined, 
    /**
     * The error in case of a rejected promise.
     * Undefined if the promise resolved.
     */
    error: unknown | undefined);
    /**
     * Returns the value if the promise resolved, otherwise throws the error.
     */
    getDataOrThrow(): T;
}
/**
 * Tracks a changing {@link ObservablePromise}, exposing the last resolved value
 * and whether a newer promise is still pending.
 */
export declare class ObservableResolvedPromise<T> {
    private readonly _lastResolved;
    readonly lastResolved: IObservable<T>;
    private readonly _isResolving;
    readonly isResolving: IObservable<boolean>;
    private _runningPromise;
    constructor(source: IObservable<ObservablePromise<T>>, initialValue: T, store: DisposableStore);
}
/**
 * A lazy promise whose state is observable.
 */
export declare class ObservableLazyPromise<T> {
    private readonly _computePromise;
    private readonly _lazyValue;
    /**
     * Does not enforce evaluation of the promise compute function.
     * Is undefined if the promise has not been computed yet.
     */
    readonly cachedPromiseResult: import("../base").IObservableWithChange<PromiseResult<T> | undefined, void>;
    constructor(_computePromise: () => Promise<T>);
    getPromise(): Promise<T>;
}
//# sourceMappingURL=promise.d.ts.map