import { isArray } from '../util/isArray'; import { CombineLatestOperator } from '../observable/combineLatest'; import { from } from '../observable/from'; import { Observable } from '../Observable'; import { ObservableInput, OperatorFunction } from '../types'; const none = {}; /* tslint:disable:max-line-length */ /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(project: (v1: T) => R): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, project: (v1: T, v2: T2) => R): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput, project: (v1: T, v2: T2, v3: T3) => R): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, project: (v1: T, v2: T2, v3: T3, v4: T4) => R): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R): OperatorFunction ; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): OperatorFunction ; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(...observables: Array | ((...values: Array) => R)>): OperatorFunction; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(array: ObservableInput[]): OperatorFunction>; /** @deprecated Deprecated in favor of static combineLatest. */ export function combineLatest(array: ObservableInput[], project: (v1: T, ...values: Array) => R): OperatorFunction; /* tslint:enable:max-line-length */ /** * @deprecated Deprecated in favor of static {@link combineLatest}. */ export function combineLatest(...observables: Array | Array> | ((...values: Array) => R)>): OperatorFunction { let project: (...values: Array) => R = null; if (typeof observables[observables.length - 1] === 'function') { project = <(...values: Array) => R>observables.pop(); } // if the first and only other argument besides the resultSelector is an array // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` if (observables.length === 1 && isArray(observables[0])) { observables = (observables[0]).slice(); } return (source: Observable) => source.lift.call(from([source, ...observables]), new CombineLatestOperator(project)); }