Skip to content

Commit

Permalink
fix(Subscriber): next method no longer has optional value argument
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Jun 19, 2023
1 parent 0fe6b2f commit 59162c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions spec-dtslint/Observable-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,11 @@ describe('pipe', () => {
const o2 = of(123).pipe(map(n => n + '?'), source => source.subscribe()); // $ExpectType Subscription
const o3 = of('test').pipe(map(n => n + ':' + n), filter(n => n < 30)); // $ExpectError
})
});

it('should provide the proper types to the subscriber', () => {
const o1$ = new Observable<number>(subscriber => {
const next = subscriber.next; // $ExpectType (value: number) => void
subscriber.next(); // $ExpectError
});
});
2 changes: 1 addition & 1 deletion src/internal/Subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
* times.
* @param value The `next` value.
*/
next(value?: T): void {
next(value: T): void {
if (this.isStopped) {
handleStoppedNotification(nextNotification(value), this);
} else {
Expand Down

0 comments on commit 59162c7

Please sign in to comment.