UNPKG

718 BTypeScriptView Raw
1import type { Atom, WritableAtom } from 'jotai';
2type Getter = Parameters<Atom<unknown>['read']>[0];
3type WriteGetter = Parameters<WritableAtom<unknown, unknown>['write']>[0];
4type Setter = Parameters<WritableAtom<unknown, unknown>['write']>[1];
5type Read<Value> = (get: Getter, options: {
6 signal: AbortSignal;
7}) => Value;
8type Write<Update, Result extends void | Promise<void>> = (get: WriteGetter, set: Setter, update: Update) => Result;
9export declare function abortableAtom<Value, Update, Result extends void | Promise<void> = void>(read: Read<Value>, write: Write<Update, Result>): WritableAtom<Value, Update, Result>;
10export declare function abortableAtom<Value>(read: Read<Value>): Atom<Value>;
11export {};