Merge pull request #26483 from itomtom/feat/types/zen-observable

[zen-observable] Add 'concat' method
This commit is contained in:
Paul van Brenk
2018-06-25 15:53:11 -07:00
committed by GitHub
2 changed files with 11 additions and 1 deletions
+3 -1
View File
@@ -1,7 +1,8 @@
// Type definitions for zen-observable 0.5
// Type definitions for zen-observable 0.8
// Project: https://github.com/zenparsing/zen-observable
// Definitions by: Kombu <https://github.com/aicest>
// JounQin <https://github.com/JounQin>
// Thomas <https://github.com/itomtom>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare global {
@@ -52,6 +53,7 @@ declare class Observable<T> {
reduce(callback: (previousValue: T, currentValue: T) => T, initialValue?: T): Observable<T>;
reduce<R>(callback: (previousValue: R, currentValue: T) => R, initialValue?: R): Observable<R>;
flatMap<R>(callback: (value: T) => ZenObservable.ObservableLike<R>): Observable<R>;
concat<R>(...observable: Array<Observable<R>>): Observable<R>;
static from<R>(observable: Observable<R> | ZenObservable.ObservableLike<R> | ArrayLike<R>): Observable<R>;
static of<R>(...items: R[]): Observable<R>;
@@ -94,6 +94,14 @@ Observable.of(1, 2, 3)
.flatMap(val => Observable.of(val.toString()))
.subscribe(val => assert(typeof val === 'string'));
/**
* observable.concat
*/
Observable.of(1, 2, 3)
.concat(Observable.of(4, 5, 6), Observable.of(7, 8, 9))
.subscribe(val => assert(typeof val === 'number'));
/**
* ZenObservable
*/