Skip to content

Commit d2a32f9

Browse files
evmarbenlesh
authored andcommitted
fix(compilation): compile under typescript 2.4 (#2780)
TypeScript 2.4 is more strict about assignability with generics, and in some cases (when calling a generic function) it will infer that the generic parameter is <{}> rather than the <T> that rxjs typically wants. Fix this by explicitly passing <T> in the cases where compilation fails.
1 parent b8a324f commit d2a32f9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/observable/FromObservable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class FromObservable<T> extends Observable<T> {
9191
return new FromObservable<T>(ish, scheduler);
9292
} else if (isArray(ish)) {
9393
return new ArrayObservable<T>(ish, scheduler);
94-
} else if (isPromise(ish)) {
94+
} else if (isPromise<T>(ish)) {
9595
return new PromiseObservable<T>(ish, scheduler);
9696
} else if (typeof ish[Symbol_iterator] === 'function' || typeof ish === 'string') {
9797
return new IteratorObservable<T>(ish, scheduler);

src/operator/catch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import { subscribeToResult } from '../util/subscribeToResult';
6666
*/
6767
export function _catch<T, R>(this: Observable<T>, selector: (err: any, caught: Observable<T>) => ObservableInput<R>): Observable<T | R> {
6868
const operator = new CatchOperator(selector);
69-
const caught = this.lift(operator);
69+
const caught = this.lift<T>(operator);
7070
return (operator.caught = caught);
7171
}
7272

src/operator/defaultIfEmpty.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function defaultIfEmpty<T, R>(this: Observable<T>, defaultValue?: R): Obs
3838
* @owner Observable
3939
*/
4040
export function defaultIfEmpty<T, R>(this: Observable<T>, defaultValue: R = null): Observable<T | R> {
41-
return this.lift(new DefaultIfEmptyOperator(defaultValue));
41+
return this.lift<T>(new DefaultIfEmptyOperator(defaultValue));
4242
}
4343

4444
class DefaultIfEmptyOperator<T, R> implements Operator<T, T | R> {

0 commit comments

Comments
 (0)