import { type FromSubscribableObservable, type Subscribable } from '../types/index.mjs'; /** * Converts any subscribable object into a SynState Observable. * Works with objects that have a subscribe(onNext, onError, onComplete) method. * * @template A - The type of values from the subscribable * @template E - The type of errors from the subscribable * @param subscribable - An object with a subscribe method * @returns An observable that wraps values in Result type * * @example * ```ts * // Explanation: * // - fromSubscribable converts any subscribable object into a SynState Observable * // - Works with objects that have a subscribe(onNext, onError, onComplete) method * // - Wraps values in Result type for error handling * // - Useful for integrating with other reactive libraries or custom subscribables * * // Example: Converting a custom subscribable * const customSubscribable = { * subscribe: ( * onNext: (value: number) => void, * _onError?: (error: unknown) => void, * onComplete?: () => void, * ) => { * setTimeout(() => { * onNext(1); * * onNext(2); * * onNext(3); * * onComplete?.(); * }, 0); * * return { unsubscribe: () => {} }; * }, * } as const; * * const observable$ = fromSubscribable(customSubscribable); * * const valueHistory: number[] = []; * * await new Promise((resolve) => { * observable$.subscribe( * (result) => { * if (Result.isOk(result)) { * valueHistory.push(result.value); * } * }, * () => { * resolve(); * }, * ); * }); * * assert.deepStrictEqual(valueHistory, [1, 2, 3]); * ``` */ export declare const fromSubscribable: (subscribable: Subscribable) => FromSubscribableObservable; //# sourceMappingURL=from-subscribable.d.mts.map