1 | import { Setter, WritableAtom } from 'jotai';
|
2 | import { Scope } from '../core/atom';
|
3 | declare type WriteGetter = Parameters<WritableAtom<unknown, unknown>['write']>[0];
|
4 | declare type Callback<Result, Arg> = undefined extends Arg ? (arg?: Arg) => Result : (arg: Arg) => Result;
|
5 | export declare function useAtomCallback<Result, Arg>(callback: (get: WriteGetter, set: Setter, arg: Arg) => Promise<Result>, scope?: Scope): Callback<Promise<Result>, Arg>;
|
6 | export declare function useAtomCallback<Result, Arg>(callback: (get: WriteGetter, set: Setter, arg: Arg) => Result, scope?: Scope): Callback<Result | Promise<Result>, Arg>;
|
7 | export {};
|