From 64ba901f31291cce2072e230a424ab12b20913b2 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Tue, 14 Nov 2017 13:23:24 -0800 Subject: [PATCH] fix(Subject): make value parameter for next non-optional Prevents emitting undefined on strictly-typed Subjects BREAKING CHANGE: If you are using TypeScript called next() without a value before, TypeScript will error. If the Subject is of type void, explicitely pass undefined to next(). closes #2852 --- src/Subject.ts | 2 +- src/operators/repeatWhen.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Subject.ts b/src/Subject.ts index 447b80ce56..97d606c697 100644 --- a/src/Subject.ts +++ b/src/Subject.ts @@ -49,7 +49,7 @@ export class Subject extends Observable implements ISubscription { return subject; } - next(value?: T) { + next(value: T) { if (this.closed) { throw new ObjectUnsubscribedError(); } diff --git a/src/operators/repeatWhen.ts b/src/operators/repeatWhen.ts index daa4fdaa20..5151c91233 100644 --- a/src/operators/repeatWhen.ts +++ b/src/operators/repeatWhen.ts @@ -46,7 +46,7 @@ class RepeatWhenOperator implements Operator { */ class RepeatWhenSubscriber extends OuterSubscriber { - private notifications: Subject; + private notifications: Subject; private retries: Observable; private retriesSubscription: Subscription; private sourceIsBeingSubscribedTo: boolean = true; @@ -81,7 +81,7 @@ class RepeatWhenSubscriber extends OuterSubscriber { } this._unsubscribeAndRecycle(); - this.notifications.next(); + this.notifications.next(undefined); } }