Skip to content

Commit

Permalink
fix(Subject): make value parameter for next non-optional
Browse files Browse the repository at this point in the history
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 ReactiveX#2852
  • Loading branch information
felixfbecker committed Nov 14, 2017
1 parent cd9626a commit 64ba901
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Subject<T> extends Observable<T> implements ISubscription {
return <any>subject;
}

next(value?: T) {
next(value: T) {
if (this.closed) {
throw new ObjectUnsubscribedError();
}
Expand Down
4 changes: 2 additions & 2 deletions src/operators/repeatWhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RepeatWhenOperator<T> implements Operator<T, T> {
*/
class RepeatWhenSubscriber<T, R> extends OuterSubscriber<T, R> {

private notifications: Subject<any>;
private notifications: Subject<void>;
private retries: Observable<any>;
private retriesSubscription: Subscription;
private sourceIsBeingSubscribedTo: boolean = true;
Expand Down Expand Up @@ -81,7 +81,7 @@ class RepeatWhenSubscriber<T, R> extends OuterSubscriber<T, R> {
}

this._unsubscribeAndRecycle();
this.notifications.next();
this.notifications.next(undefined);
}
}

Expand Down

0 comments on commit 64ba901

Please sign in to comment.