| 1 |
import { combineLatestInit } from '../observable/combineLatest'; |
| 2 |
import { ObservableInput, ObservableInputTuple, OperatorFunction } from '../types'; |
| 3 |
import { operate } from '../util/lift'; |
| 4 |
import { argsOrArgArray } from '../util/argsOrArgArray'; |
| 5 |
import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs'; |
| 6 |
import { pipe } from '../util/pipe'; |
| 7 |
import { popResultSelector } from '../util/args'; |
| 8 |
|
| 9 |
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ |
| 10 |
export function combineLatest<T, A extends readonly unknown[], R>( |
| 11 |
sources: [...ObservableInputTuple<A>], |
| 12 |
project: (...values: [T, ...A]) => R |
| 13 |
): OperatorFunction<T, R>; |
| 14 |
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ |
| 15 |
export function combineLatest<T, A extends readonly unknown[], R>(sources: [...ObservableInputTuple<A>]): OperatorFunction<T, [T, ...A]>; |
| 16 |
|
| 17 |
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ |
| 18 |
export function combineLatest<T, A extends readonly unknown[], R>( |
| 19 |
...sourcesAndProject: [...ObservableInputTuple<A>, (...values: [T, ...A]) => R] |
| 20 |
): OperatorFunction<T, R>; |
| 21 |
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ |
| 22 |
export function combineLatest<T, A extends readonly unknown[], R>(...sources: [...ObservableInputTuple<A>]): OperatorFunction<T, [T, ...A]>; |
| 23 |
|
| 24 |
/** |
| 25 |
* @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. |
| 26 |
*/ |
| 27 |
export function combineLatest<T, R>(...args: (ObservableInput<any> | ((...values: any[]) => R))[]): OperatorFunction<T, unknown> { |
| 28 |
const resultSelector = popResultSelector(args); |
| 29 |
return resultSelector |
| 30 |
? pipe(combineLatest(...(args as Array<ObservableInput<any>>)), mapOneOrManyArgs(resultSelector)) |
| 31 |
: operate((source, subscriber) => { |
| 32 |
combineLatestInit([source, ...argsOrArgArray(args)])(subscriber); |
| 33 |
}); |
| 34 |
} |