import { Observer } from '../objects/observable'; import { SealedPartial, SealedState } from '../results/sealed'; interface StreamResponse { response: T; responseTime: number; } interface StreamState extends SealedState { failure: (error: any) => V; loading: () => V; success: (state: StreamResponse) => V; } export declare class Stream extends SealedPartial, StreamState> { static loading(): Stream; static success(value: StreamResponse): Stream; static failure(error: any): Stream; } declare class StreamStatus { readonly isLoading: boolean; readonly isSuccessful: boolean; readonly isError: boolean; readonly value?: T | undefined; readonly error?: E | undefined; private constructor(); static loading(): StreamStatus; static successful(value?: T): StreamStatus; static error(error?: E): StreamStatus; } type StreamObserver = (observer: Observer>) => Unsubscription; interface StreamSubscription { subscribe: StreamObserver; } interface StreamStateSubscription { subscribe: (state: Partial>) => Unsubscription; } interface StreamStatusSubscription { subscribe: (observer: (status: StreamStatus) => void) => Unsubscription; } export declare function stream(promise: Promise): StreamSubscription; export declare function streamValue(promise: Promise): StreamStateSubscription; export declare function streamStatus(promise: Promise): StreamStatusSubscription; export {};