1 | export declare type SetStateAction<Value> = Value | ((prev: Value) => Value);
|
2 | export declare type Getter = <Value>(atom: Atom<Value>) => Value;
|
3 | export declare type Setter = <Value, Update>(atom: WritableAtom<Value, Update>, update: Update) => void;
|
4 | export declare type Scope = symbol | string | number;
|
5 | export declare type SetAtom<Update> = undefined extends Update ? (update?: Update) => void | Promise<void> : (update: Update) => void | Promise<void>;
|
6 | export declare type OnUnmount = () => void;
|
7 | export declare type OnMount<Update> = <S extends SetAtom<Update>>(setAtom: S) => OnUnmount | void;
|
8 | export declare type Atom<Value> = {
|
9 | toString: () => string;
|
10 | debugLabel?: string;
|
11 | scope?: Scope;
|
12 | read: (get: Getter) => Value | Promise<Value>;
|
13 | };
|
14 | export declare type WritableAtom<Value, Update> = Atom<Value> & {
|
15 | write: (get: Getter, set: Setter, update: Update) => void | Promise<void>;
|
16 | onMount?: OnMount<Update>;
|
17 | };
|
18 | export declare type WithInitialValue<Value> = {
|
19 | init: Value;
|
20 | };
|
21 | export declare type PrimitiveAtom<Value> = WritableAtom<Value, SetStateAction<Value>>;
|
22 | export declare type AnyAtom = Atom<unknown>;
|
23 | export declare type AnyWritableAtom = WritableAtom<unknown, unknown>;
|