1 | import { Atom, SetAtom, WritableAtom } from './atom';
|
2 | import { 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): [
|
6 | Value,
|
7 | SetAtom<Update, Result>
|
8 | ];
|
9 | export declare function useAtom<Value>(atom: Atom<Promise<Value>>, scope?: Scope): [
|
10 | Value,
|
11 | never
|
12 | ];
|
13 | export declare function useAtom<Value, Update, Result extends void | Promise<void>>(atom: WritableAtom<Value, Update, Result>, scope?: Scope): [
|
14 | Awaited<Value>,
|
15 | SetAtom<Update, Result>
|
16 | ];
|
17 | export declare function useAtom<Value>(atom: Atom<Value>, scope?: Scope): [
|
18 | Awaited<Value>,
|
19 | never
|
20 | ];
|
21 | export declare function useAtom<AtomType extends WritableAtom<any, any, void | Promise<void>>>(atom: AtomType, scope?: Scope): [
|
22 | Awaited<ExtractAtomValue<AtomType>>,
|
23 | SetAtom<ExtractAtomUpdate<AtomType>, ExtractAtomResult<AtomType>>
|
24 | ];
|
25 | export declare function useAtom<AtomType extends Atom<any>>(atom: AtomType, scope?: Scope): [
|
26 | Awaited<ExtractAtomValue<AtomType>>,
|
27 | never
|
28 | ];
|
29 | export {};
|
30 | declare type Awaited<T> = T extends Promise<infer V> ? V : T; |
\ | No newline at end of file |