import { Stream } from '@motorcycle/types'; /** * Applies a function, which returns a higher-order stream, to each event value * of a stream and returns a new stream that adopts the behavior of (i.e., * emits the events of) the most recent inner stream. * * @name switchMap(f: (a: A) => Stream, s: Stream): Stream * * @example * import { now, scan, switchMap, observe, skip } from '@motorcycle/stream' * * const a$ = now(1) * const b$ = now(2) * const f = (a: number) => scan((x, y) => x + y, a, b$) * const s = skip(1, switchMap(f, a$)) * * observe(console.log, s) // 3 */ export declare const switchMap: SwitchMapArity2; export interface SwitchMapArity2 { (f: (a: A) => Stream, s: Stream): Stream; (f: (a: A) => Stream): SwitchMapArity1; } export interface SwitchMapArity1 { (s: Stream): Stream; }