Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit ca0f50b

Browse files
Updated defintions to split up Observable/Promises from Array/Iterables so that TS can resolve them properly
1 parent f7eb774 commit ca0f50b

45 files changed

Lines changed: 2123 additions & 321 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ts/core/disposables/booleandisposable.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ module Rx {
4343
sad.isDisposed;
4444
var d = sad.getDisposable();
4545
sad.setDisposable(d);
46-
});
47-
48-
(function() {
46+
4947
var sad: Rx.SerialDisposable = new Rx.SerialDisposable();
5048
sad.dispose();
5149
sad.isDisposed;

ts/core/es5.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ module Rx {
77
// Type alias for arrays and array like objects
88
export type ArrayOrIterable<T> = ArrayLike<T>;
99

10-
// Type alias for observables, promises or arrays (some methods automatically call .from on an array result)
11-
export type ObservableOrPromiseOrIterable<T> = ObservableOrPromise<T> | ArrayOrIterable<T>;
12-
1310
/**
1411
* Promise A+
1512
*/

ts/core/es6.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ module Rx {
99
// Type alias for arrays and array like objects
1010
export type ArrayOrIterable<T> = ArrayLike<T> | Iterable<T>;
1111

12-
// Type alias for observables, promises or arrays (some methods automatically call .from on an array result)
13-
export type ObservableOrPromiseOrIterable<T> = ObservableOrPromise<T> | ArrayOrIterable<T>;
14-
1512
/**
1613
* Promise A+
1714
*/

ts/core/linq/observable/concatmap.ts

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Rx {
2020
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
2121
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
2222
*/
23-
concatMap<TResult>(selector: _ValueOrSelector<T, ObservableOrPromiseOrIterable<TResult>>): Observable<TResult>;
23+
concatMap<TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
2424
/**
2525
* One of the Following:
2626
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
@@ -40,7 +40,7 @@ module Rx {
4040
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
4141
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
4242
*/
43-
concatMap<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromiseOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
43+
concatMap<TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
4444
/**
4545
* One of the Following:
4646
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
@@ -60,7 +60,7 @@ module Rx {
6060
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
6161
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
6262
*/
63-
selectConcat<TResult>(selector: _ValueOrSelector<T, ObservableOrPromiseOrIterable<TResult>>): Observable<TResult>;
63+
concatMap<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
6464
/**
6565
* One of the Following:
6666
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
@@ -80,7 +80,87 @@ module Rx {
8080
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
8181
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
8282
*/
83-
selectConcat<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromiseOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
83+
concatMap<TOther, TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
84+
/**
85+
* One of the Following:
86+
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
87+
*
88+
* @example
89+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
90+
* Or:
91+
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
92+
*
93+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
94+
* Or:
95+
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
96+
*
97+
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
98+
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
99+
* source sequence onto which could be either an observable or Promise.
100+
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
101+
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
102+
*/
103+
selectConcat<TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
104+
/**
105+
* One of the Following:
106+
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
107+
*
108+
* @example
109+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
110+
* Or:
111+
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
112+
*
113+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
114+
* Or:
115+
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
116+
*
117+
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
118+
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
119+
* source sequence onto which could be either an observable or Promise.
120+
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
121+
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
122+
*/
123+
selectConcat<TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
124+
/**
125+
* One of the Following:
126+
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
127+
*
128+
* @example
129+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
130+
* Or:
131+
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
132+
*
133+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
134+
* Or:
135+
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
136+
*
137+
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
138+
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
139+
* source sequence onto which could be either an observable or Promise.
140+
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
141+
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
142+
*/
143+
selectConcat<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
144+
/**
145+
* One of the Following:
146+
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
147+
*
148+
* @example
149+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
150+
* Or:
151+
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
152+
*
153+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
154+
* Or:
155+
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
156+
*
157+
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
158+
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
159+
* source sequence onto which could be either an observable or Promise.
160+
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
161+
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
162+
*/
163+
selectConcat<TOther, TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
84164
}
85165
}
86166

@@ -91,29 +171,29 @@ module Rx {
91171

92172
on = os.concatMap((v, i) => Rx.Observable.range(0, i));
93173
os = os.concatMap(z => Rx.Observable.just('abc').toPromise());
94-
on = os.concatMap(z => [1,2,3]);
174+
on = os.concatMap(z => [1, 2, 3]);
95175

96176
os = os.concatMap((v, i) => Rx.Observable.range(0, i), (v1, v2, i) => v2.toString());
97177
on = os.concatMap(z => Rx.Observable.just('abc').toPromise(), (v1, v2, i) => i);
98-
on = os.concatMap(z => [1,2,3], (v1, v2, i) => i);
178+
on = os.concatMap(z => [1, 2, 3], (v1, v2, i) => i);
99179

100180
os.concatMap(on);
101181
os = os.concatMap(Rx.Observable.range(0, 5), (v1, v2, i) => v2.toString());
102182
on = os.concatMap(Rx.Observable.just('abc').toPromise(), (v1, v2, i) => i);
103-
on = os.concatMap([1,2,3], (v1, v2, i) => i);
183+
on = os.concatMap([1, 2, 3], (v1, v2, i) => i);
104184

105185
on = os.selectConcat((v, i) => Rx.Observable.range(0, i));
106186

107187
on = os.selectConcat((v, i) => Rx.Observable.range(0, i));
108188
os = os.selectConcat(z => Rx.Observable.just('abc').toPromise());
109-
on = os.selectConcat(z => [1,2,3]);
189+
on = os.selectConcat(z => [1, 2, 3]);
110190

111191
os = os.selectConcat((v, i) => Rx.Observable.range(0, i), (v1, v2, i) => v2.toString());
112192
on = os.selectConcat(z => Rx.Observable.just('abc').toPromise(), (v1, v2, i) => i);
113-
on = os.selectConcat(z => [1,2,3], (v1, v2, i) => i);
193+
on = os.selectConcat(z => [1, 2, 3], (v1, v2, i) => i);
114194

115195
os.selectConcat(on);
116196
os = os.selectConcat(Rx.Observable.range(0, 5), (v1, v2, i) => v2.toString());
117197
on = os.selectConcat(Rx.Observable.just('abc').toPromise(), (v1, v2, i) => i);
118-
on = os.selectConcat([1,2,3], (v1, v2, i) => i);
198+
on = os.selectConcat([1, 2, 3], (v1, v2, i) => i);
119199
});

0 commit comments

Comments
 (0)