import { ObservableInput, ObservableInputTuple, OperatorFunction, SchedulerLike } from '../types'; import { operate } from '../util/lift'; import { argsOrArgArray } from '../util/argsOrArgArray'; import { mergeAll } from './mergeAll'; import { popNumber, popScheduler } from '../util/args'; import { from } from '../observable/from'; /** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge(...sources: [...ObservableInputTuple]): OperatorFunction; /** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge( ...sourcesAndConcurrency: [...ObservableInputTuple, number] ): OperatorFunction; /** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge( ...sourcesAndScheduler: [...ObservableInputTuple, SchedulerLike] ): OperatorFunction; /** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge( ...sourcesAndConcurrencyAndScheduler: [...ObservableInputTuple, number, SchedulerLike] ): OperatorFunction; export function merge(...args: unknown[]): OperatorFunction { const scheduler = popScheduler(args); const concurrent = popNumber(args, Infinity); args = argsOrArgArray(args); return operate((source, subscriber) => { mergeAll(concurrent)(from([source, ...(args as ObservableInput[])], scheduler)).subscribe(subscriber); }); }