1 | import type { Atom, Getter, WritableAtom } from 'jotai';
|
2 | type AnyError = unknown;
|
3 | declare global {
|
4 | interface SymbolConstructor {
|
5 | readonly observable: symbol;
|
6 | }
|
7 | }
|
8 | type Subscription = {
|
9 | unsubscribe: () => void;
|
10 | };
|
11 | type Observer<T> = {
|
12 | next: (value: T) => void;
|
13 | error: (error: AnyError) => void;
|
14 | complete: () => void;
|
15 | };
|
16 | type ObservableLike<T> = {
|
17 | [Symbol.observable]?: () => ObservableLike<T> | undefined;
|
18 | } & ({
|
19 | subscribe(observer: Partial<Observer<T>>): Subscription;
|
20 | } | {
|
21 | subscribe(observer: Partial<Observer<T>>): Subscription;
|
22 | subscribe(next: (value: T) => void): Subscription;
|
23 | });
|
24 | type SubjectLike<T> = ObservableLike<T> & Observer<T>;
|
25 | type Options<Data> = {
|
26 | initialValue?: Data | (() => Data);
|
27 | unstable_timeout?: number;
|
28 | };
|
29 | export declare function atomWithObservable<Data>(getObservable: (get: Getter) => SubjectLike<Data>, options?: Options<Data>): WritableAtom<Data, Data>;
|
30 | export declare function atomWithObservable<Data>(getObservable: (get: Getter) => ObservableLike<Data>, options?: Options<Data>): Atom<Data>;
|
31 | export {};
|
32 |
|
\ | No newline at end of file |