1 | import type { Atom, SetAtom, WritableAtom } from './atom';
|
2 | import type { ExtractAtomResult, ExtractAtomUpdate, ExtractAtomValue } from './typeUtils';
|
3 | import { useAtomValue } from './useAtomValue';
|
4 | type Scope = NonNullable<Parameters<typeof useAtomValue>[1]>;
|
5 | export declare function useAtom<Value, Update, Result extends void | Promise<void>>(atom: WritableAtom<Promise<Value>, Update, Result>, scope?: Scope): [Value, SetAtom<Update, Result>];
|
6 | export declare function useAtom<Value>(atom: Atom<Promise<Value>>, scope?: Scope): [Value, never];
|
7 | export declare function useAtom<Value, Update, Result extends void | Promise<void>>(atom: WritableAtom<Value, Update, Result>, scope?: Scope): [Awaited<Value>, SetAtom<Update, Result>];
|
8 | export declare function useAtom<Value>(atom: Atom<Value>, scope?: Scope): [Awaited<Value>, never];
|
9 | export declare function useAtom<AtomType extends WritableAtom<any, any, void | Promise<void>>>(atom: AtomType, scope?: Scope): [
|
10 | Awaited<ExtractAtomValue<AtomType>>,
|
11 | SetAtom<ExtractAtomUpdate<AtomType>, ExtractAtomResult<AtomType>>
|
12 | ];
|
13 | export declare function useAtom<AtomType extends Atom<any>>(atom: AtomType, scope?: Scope): [Awaited<ExtractAtomValue<AtomType>>, never];
|
14 | export {};
|