UNPKG

@ngneat/loadoff

Version:

<p align="center"> <img width="20%" height="20%" src="./logo.svg"> </p>

21 lines (20 loc) 891 B
import { OperatorFunction } from 'rxjs'; export declare class AsyncState<T, E = any> { res: T | undefined; error: E | undefined; loading: boolean; success: boolean; complete: boolean; constructor(state?: Partial<AsyncState<T, E>>); } export declare function createAsyncState<T, E = any>(state?: Partial<AsyncState<T, E>>): AsyncState<T, E>; export declare function createSyncState<T, E = any>(res: T): AsyncState<T, E>; export declare function isSuccess<T>(state: AsyncState<T>): state is AsyncState<T> & { res: T; }; export declare function hasError<T>(state: AsyncState<T>): state is AsyncState<T> & { res: undefined; }; export declare function isComplete(state: AsyncState<unknown>): boolean; export declare function isLoading(state: AsyncState<unknown>): boolean; export declare function toAsyncState<T, E = any>(): OperatorFunction<T, AsyncState<T, E>>;