import type { PartialObserver } from './types/inputs/Observer.js'; import type { Subscribable, SubscribableValue } from './types/inputs/Subscribable.js'; import type { MappingKey } from './types/mapping.js'; import type { ListenEventMap, StrictListenable } from './types/outputs/StrictListenable.js'; export type WatchCleanup = () => void; export type WatchCallback = (data: D) => WatchCleanup | void; export interface WatchObserver extends PartialObserver { next?: ((data: D) => void | WatchCleanup) | undefined; error?: ((error: unknown) => void | WatchCleanup) | undefined; } /** * Register a callback that may return a cleanup function. * The cleanup function will be called before next call of the callback or when the observable completes. */ export declare function watch$(observable: O, callback: WatchCallback>): ReturnType; /** * Register an observer that may return a cleanup function. * The cleanup function will be called before next call of the callback or when the observable completes. */ export declare function watch$(observable: O, observer: Partial>>): ReturnType; /** * Register a callback to a given event that may return a cleanup function. * The cleanup function will be called before next call of the callback or when the observable completes. */ export declare function watch$>>(listenable: L, key: K, observer: WatchCallback[K]>): ReturnType; /** * Register an observer to a given event that may return a cleanup function. * The cleanup function will be called before next call of the callback or when the observable completes. */ export declare function watch$>>(listenable: L, key: K, observer: Partial[K]>>): ReturnType;