1 import { Observable } from '../Observable';
2 import { concat } from '../observable/concat';
3 import { of } from '../observable/of';
4 import { MonoTypeOperatorFunction, SchedulerLike, OperatorFunction } from '../types';
6 /* tslint:disable:max-line-length */
7 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
8 export function endWith<T>(scheduler: SchedulerLike): MonoTypeOperatorFunction<T>;
9 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
10 export function endWith<T, A>(v1: A, scheduler: SchedulerLike): OperatorFunction<T, T | A>;
11 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
12 export function endWith<T, A, B>(v1: A, v2: B, scheduler: SchedulerLike): OperatorFunction<T, T | A | B>;
13 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
14 export function endWith<T, A, B, C>(v1: A, v2: B, v3: C, scheduler: SchedulerLike): OperatorFunction<T, T | A | B | C>;
15 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
16 export function endWith<T, A, B, C, D>(v1: A, v2: B, v3: C, v4: D, scheduler: SchedulerLike): OperatorFunction<T, T | A | B | C | D>;
17 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
18 export function endWith<T, A, B, C, D, E>(v1: A, v2: B, v3: C, v4: D, v5: E, scheduler: SchedulerLike): OperatorFunction<T, T | A | B | C | D | E>;
19 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
20 export function endWith<T, A, B, C, D, E, F>(v1: A, v2: B, v3: C, v4: D, v5: E, v6: F, scheduler: SchedulerLike): OperatorFunction<T, T | A | B | C | D | E | F>;
22 export function endWith<T, A>(v1: A): OperatorFunction<T, T | A>;
23 export function endWith<T, A, B>(v1: A, v2: B): OperatorFunction<T, T | A | B>;
24 export function endWith<T, A, B, C>(v1: A, v2: B, v3: C): OperatorFunction<T, T | A | B | C>;
25 export function endWith<T, A, B, C, D>(v1: A, v2: B, v3: C, v4: D): OperatorFunction<T, T | A | B | C | D>;
26 export function endWith<T, A, B, C, D, E>(v1: A, v2: B, v3: C, v4: D, v5: E): OperatorFunction<T, T | A | B | C | D | E>;
27 export function endWith<T, A, B, C, D, E, F>(v1: A, v2: B, v3: C, v4: D, v5: E, v6: F): OperatorFunction<T, T | A | B | C | D | E | F>;
28 export function endWith<T, Z = T>(...array: Z[]): OperatorFunction<T, T | Z>;
29 /** @deprecated use {@link scheduled} and {@link concatAll} (e.g. `scheduled([source, [a, b, c]], scheduler).pipe(concatAll())`) */
30 export function endWith<T, Z = T>(...array: Array<Z | SchedulerLike>): OperatorFunction<T, T | Z>;
31 /* tslint:enable:max-line-length */
34 * Returns an Observable that emits the items you specify as arguments after it finishes emitting
35 * items emitted by the source Observable.
40 * ### After the source observable completes, appends an emission and then completes too.
43 * import { of } from 'rxjs';
44 * import { endWith } from 'rxjs/operators';
46 * of('hi', 'how are you?', 'sorry, I have to go now').pipe(
47 * endWith('goodbye!'),
49 * .subscribe(word => console.log(word));
53 * // 'sorry, I have to go now'
57 * @param {...T} values - Items you want the modified Observable to emit last.
58 * @param {SchedulerLike} [scheduler] - A {@link SchedulerLike} to use for scheduling
59 * the emissions of the `next` notifications.
60 * @return {Observable} An Observable that emits the items emitted by the source Observable
61 * and then emits the items in the specified Iterable.
65 export function endWith<T>(...array: Array<T | SchedulerLike>): MonoTypeOperatorFunction<T> {
66 return (source: Observable<T>) => concat(source, of(...array)) as Observable<T>;