declare type Awaited = T extends Promise ? Awaited : T; declare type Getter = { (atom: Atom>): Value; (atom: Atom>): Value; (atom: Atom): Awaited; }; declare type WriteGetter = Getter & { (atom: Atom>, options: { unstable_promise: true; }): Promise | Value; (atom: Atom>, options: { unstable_promise: true; }): Promise | Value; (atom: Atom, options: { unstable_promise: true; }): Promise> | Awaited; }; declare type Setter = { >(atom: WritableAtom): Result; >(atom: WritableAtom, update: Update): Result; }; declare type Read = (get: Getter) => Value; declare type Write> = (get: WriteGetter, set: Setter, update: Update) => Result; declare type WithInitialValue = { init: Value; }; export declare type Scope = symbol | string | number; export declare type SetAtom> = undefined extends Update ? (update?: Update) => Result : (update: Update) => Result; declare type OnUnmount = () => void; declare type OnMount> = >(setAtom: S) => OnUnmount | void; export interface Atom { toString: () => string; debugLabel?: string; read: Read; } export interface WritableAtom = void> extends Atom { write: Write; onMount?: OnMount; } declare type SetStateAction = Value | ((prev: Value) => Value); export declare type PrimitiveAtom = WritableAtom>; export declare function atom = void>(read: Read, write: Write): WritableAtom; export declare function atom(read: Read): Atom; export declare function atom(invalidFunction: (...args: any) => any, write?: any): never; export declare function atom = void>(initialValue: Value, write: Write): WritableAtom & WithInitialValue; export declare function atom(initialValue: Value): PrimitiveAtom & WithInitialValue; export {};