UNPKG

jotai

Version:

👻 Next gen state management that will spook you

14 lines (13 loc) • 370 B
import { Atom } from 'jotai'; declare type ResolveType<T> = T extends Promise<infer V> ? V : T; declare type Loadable<Value> = { state: 'loading'; } | { state: 'hasError'; error: unknown; } | { state: 'hasData'; data: ResolveType<Value>; }; export declare function loadable<Value>(anAtom: Atom<Value>): Atom<Loadable<Value>>; export {};