From d2a32f9a18ebbf65bea798f558364571c91a9d79 Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Thu, 3 Aug 2017 16:12:21 -0700 Subject: [PATCH] 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 that rxjs typically wants. Fix this by explicitly passing in the cases where compilation fails. --- src/observable/FromObservable.ts | 2 +- src/operator/catch.ts | 2 +- src/operator/defaultIfEmpty.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/observable/FromObservable.ts b/src/observable/FromObservable.ts index f1de29590b..5585d20ce5 100644 --- a/src/observable/FromObservable.ts +++ b/src/observable/FromObservable.ts @@ -91,7 +91,7 @@ export class FromObservable extends Observable { return new FromObservable(ish, scheduler); } else if (isArray(ish)) { return new ArrayObservable(ish, scheduler); - } else if (isPromise(ish)) { + } else if (isPromise(ish)) { return new PromiseObservable(ish, scheduler); } else if (typeof ish[Symbol_iterator] === 'function' || typeof ish === 'string') { return new IteratorObservable(ish, scheduler); diff --git a/src/operator/catch.ts b/src/operator/catch.ts index 1a2f470783..c244f07ebf 100644 --- a/src/operator/catch.ts +++ b/src/operator/catch.ts @@ -66,7 +66,7 @@ import { subscribeToResult } from '../util/subscribeToResult'; */ export function _catch(this: Observable, selector: (err: any, caught: Observable) => ObservableInput): Observable { const operator = new CatchOperator(selector); - const caught = this.lift(operator); + const caught = this.lift(operator); return (operator.caught = caught); } diff --git a/src/operator/defaultIfEmpty.ts b/src/operator/defaultIfEmpty.ts index cb33ff6b4e..a28aad1271 100644 --- a/src/operator/defaultIfEmpty.ts +++ b/src/operator/defaultIfEmpty.ts @@ -38,7 +38,7 @@ export function defaultIfEmpty(this: Observable, defaultValue?: R): Obs * @owner Observable */ export function defaultIfEmpty(this: Observable, defaultValue: R = null): Observable { - return this.lift(new DefaultIfEmptyOperator(defaultValue)); + return this.lift(new DefaultIfEmptyOperator(defaultValue)); } class DefaultIfEmptyOperator implements Operator {