jotai
Version:
👻 Next gen state management that will spook you
9 lines (8 loc) • 837 B
TypeScript
import { Getter, Setter, Atom, WritableAtom, WithInitialValue, PrimitiveAtom } from './types';
declare type AnyFunction = (...args: any[]) => any;
export declare function atom<Value, Update>(read: (get: Getter) => Value | Promise<Value>, write: (get: Getter, set: Setter, update: Update) => void | Promise<void>): WritableAtom<Value, Update>;
export declare function atom<Value, Update>(read: Value, write: (get: Getter, set: Setter, update: Update) => void | Promise<void>): Value extends AnyFunction ? never : WritableAtom<Value, Update> & WithInitialValue<Value>;
export declare function atom<Value>(read: (get: Getter) => Value | Promise<Value>): Atom<Value>;
export declare function atom(read: AnyFunction): never;
export declare function atom<Value>(initialValue: Value): PrimitiveAtom<Value> & WithInitialValue<Value>;
export {};