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