Skip to content

Commit

Permalink
fix(subscriber): strict type signature for next method (#7172)
Browse files Browse the repository at this point in the history
  • Loading branch information
raveclassic authored Jun 16, 2023
1 parent b6d00c1 commit 0e2ef5e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions spec/Subscriber-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('SafeSubscriber', () => {
it('should ignore next messages after unsubscription', () => {
let times = 0;

const sub = new SafeSubscriber({
const sub = new SafeSubscriber<void>({
next() { times += 1; }
});

Expand All @@ -25,7 +25,7 @@ describe('SafeSubscriber', () => {
let times = 0;
let errorCalled = false;

const sub = new SafeSubscriber({
const sub = new SafeSubscriber<void>({
next() { times += 1; },
error() { errorCalled = true; }
});
Expand All @@ -44,7 +44,7 @@ describe('SafeSubscriber', () => {
let times = 0;
let completeCalled = false;

const sub = new SafeSubscriber({
const sub = new SafeSubscriber<void>({
next() { times += 1; },
complete() { completeCalled = true; }
});
Expand Down Expand Up @@ -268,4 +268,4 @@ describe('Subscriber', () => {
} else {
console.warn(`No support for FinalizationRegistry in Node ${process.version}`);
}
});
});
4 changes: 2 additions & 2 deletions src/internal/Subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,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 Expand Up @@ -197,7 +197,7 @@ export class SafeSubscriber<T> extends Subscriber<T> {
// The first argument is a function, not an observer. The next
// two arguments *could* be observers, or they could be empty.
partialObserver = {
next: (observerOrNext ?? undefined) as (((value: T) => void) | undefined),
next: (observerOrNext ?? undefined) as ((value: T) => void) | undefined,
error: error ?? undefined,
complete: complete ?? undefined,
};
Expand Down

0 comments on commit 0e2ef5e

Please sign in to comment.