UNPKG

371 BTypeScriptView Raw
1import { Atom } from 'jotai';
2declare type Awaited<T> = T extends Promise<infer V> ? Awaited<V> : T;
3declare type Loadable<Value> = {
4 state: 'loading';
5} | {
6 state: 'hasError';
7 error: unknown;
8} | {
9 state: 'hasData';
10 data: Awaited<Value>;
11};
12export declare function loadable<Value>(anAtom: Atom<Value>): Atom<Loadable<Value>>;
13export {};