import { Updater } from "../fun/domains/updater/state"; import { BasicFun, Fun } from "../fun/state"; export type LoadedAsyncState = { kind: "loaded"; value: a; }; export type ReloadingAsyncState = { kind: "reloading"; value: a; }; export type FailedReloadAsyncState = { kind: "failed-reload"; value: a; error: any; }; export type AsyncState = ((({ kind: "unloaded"; } | { kind: "loading"; } | ReloadingAsyncState | { kind: "error"; error: any; }) & { failedLoadingAttempts: number; }) | LoadedAsyncState | FailedReloadAsyncState) & { map: (f: BasicFun) => AsyncState; getLoadingAttempts: (this: AsyncState) => number; }; export type HasValueAsyncState = AsyncState & { kind: "loaded" | "reloading" | "failed-reload"; }; export type IsLoadingAsyncState = AsyncState & { kind: "loading" | "reloading"; }; export declare const AsyncState: { Default: { unloaded: () => AsyncState; loading: () => AsyncState; reloading: (value: a) => AsyncState; failedReload: (value: a, error?: any) => AsyncState; error: (value?: any) => AsyncState; loaded: (value: a) => AsyncState; }; Updaters: { failedLoadingAttempts: (updateAttempts: Updater) => Updater>; toUnloaded: () => Updater>; toLoading: () => Updater>; toReloading: () => Updater>; toError: (error?: any) => Updater>; toLoaded: (value: a) => Updater>; }; Operations: { map: (f: BasicFun) => Fun, AsyncState>; status: (_: AsyncState) => a | AsyncState["kind"]; hasValue: (_: AsyncState) => _ is HasValueAsyncState; isLoading: (_: AsyncState) => _ is IsLoadingAsyncState; errors: (_: AsyncState) => Array; }; }; //# sourceMappingURL=state.d.ts.map