Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use more exact return type in Notification#do #5031

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/internal/Notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ export class Notification<T> {

/**
* Given some {@link Observer} callbacks, deliver the value represented by the
* current Notification to the correctly corresponding callback.
* @param {function(value: T): void} next An Observer `next` callback.
* @param {function(err: any): void} [error] An Observer `error` callback.
* @param {function(): void} [complete] An Observer `complete` callback.
* @return {any}
* current Notification to the correctly corresponding callback and return its return value.
* @param {function(value: T): A} next An Observer `next` callback.
* @param {function(err: any): B} [error] An Observer `error` callback.
* @param {function(): C} [complete] An Observer `complete` callback.
* @return {A | B | C} return value of the executed callback, or `undefined` if no callback matched.
*/
do(next: (value: T) => void, error?: (err: any) => void, complete?: () => void): any {
do<A = undefined, B = undefined, C = undefined>(next: (value: T) => A, error?: (err: any) => B, complete?: () => C): A | B | C {
const kind = this.kind;
switch (kind) {
case 'N':
Expand Down