type Updater = (current: T) => T; type StateArg = T | Updater; interface Setter { (state: State, val: StateArg): void; (command: Command, ...args: Args): T; } type Getter = (readable: Signal) => T; interface GetterOptions { signal: AbortSignal; } type Read = (get: Getter, options: GetterOptions) => T; type Write = (visitor: { get: Getter; set: Setter; }, ...args: Args) => T; type Watch = Read; interface State { id: number; init: T; debugLabel?: string; toString: () => string; } interface Computed { id: number; read: Read; debugLabel?: string; toString: () => string; } interface Command { id: number; write: Write; debugLabel?: string; toString: () => string; } type Signal = State | Computed; interface Options { debugLabel?: string; } declare function state(init: T, options?: Options): State; declare function computed(read: Read, options?: Options): Computed; declare function command(write: Write, options?: Options): Command; interface Store { get: Getter; set: Setter; watch: Watcher; } interface WatchOptions { signal?: AbortSignal; debugLabel?: string; } type Watcher = (watch: Watch, options?: WatchOptions) => void; type StoreEventType = 'set' | 'get' | 'mount' | 'unmount' | 'computed'; type SetArgs = [StateArg] | CommandArgs; declare function createStore(): Store; type NestedAtom = (State | Computed | Command | NestedAtom)[]; interface DAGNode { signal: Signal; val: T; epoch: number; } type Edge = [DAGNode, DAGNode, number]; interface DebugStore extends Store { getReadDependencies: (atom: Computed) => NestedAtom; getDependenciesGraph: (atom: Computed) => Edge[]; getReadDependents: (atom: State | Computed) => NestedAtom; isMounted: (atom: State | Computed) => boolean; } interface AtomWatch { target: State | Computed | Command | string | RegExp; actions?: Set; } declare function createDebugStore(watches?: (AtomWatch | string | RegExp | State | Computed | Command)[], defaultActions?: StoreEventType[]): DebugStore; export { type Command, type Computed, type DebugStore, type Getter, type Read, type SetArgs, type Setter, type State, type StateArg, type Store, type Updater, type Watch as Watcher, type Write, command, computed, createDebugStore, createStore, state }; //# sourceMappingURL=index.d.ts.map