Skip to content

Commit

Permalink
fix(subscribe): Deprecate null starting parameter signatures for subs…
Browse files Browse the repository at this point in the history
…cribe (#4202)

* fix(subscribe): Deprecate null starting parameter signatures for subscribe.

* fix(tap): Deprecate null starting parameter signatures for tap.

* fix(subscribe): Update deprecation message and types
  • Loading branch information
ajcrites authored and benlesh committed Oct 10, 2018
1 parent 3cb4cfb commit c85ddf6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/internal/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ export class Observable<T> implements Subscribable<T> {
}

subscribe(observer?: PartialObserver<T>): Subscription;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: null | undefined, error: null | undefined, complete: () => void): Subscription;
/** @deprecated Use an observer instead of an error callback */
subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Subscription;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Subscription;
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
/**
* Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
Expand Down
6 changes: 6 additions & 0 deletions src/internal/operators/tap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import { noop } from '../util/noop';
import { isFunction } from '../util/isFunction';

/* tslint:disable:max-line-length */
/** @deprecated Use an observer instead of a complete callback */
export function tap<T>(next: null | undefined, error: null | undefined, complete: () => void): MonoTypeOperatorFunction<T>;
/** @deprecated Use an observer instead of an error callback */
export function tap<T>(next: null | undefined, error: (error: any) => void, complete?: () => void): MonoTypeOperatorFunction<T>;
/** @deprecated Use an observer instead of a complete callback */
export function tap<T>(next: (value: T) => void, error: null | undefined, complete: () => void): MonoTypeOperatorFunction<T>;
export function tap<T>(next?: (x: T) => void, error?: (e: any) => void, complete?: () => void): MonoTypeOperatorFunction<T>;
export function tap<T>(observer: PartialObserver<T>): MonoTypeOperatorFunction<T>;
/* tslint:enable:max-line-length */
Expand Down
6 changes: 6 additions & 0 deletions src/internal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ export type SubscribableOrPromise<T> = Subscribable<T> | Subscribable<never> | P

export interface Subscribable<T> {
subscribe(observer?: PartialObserver<T>): Unsubscribable;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: null | undefined, error: null | undefined, complete: () => void): Unsubscribable;
/** @deprecated Use an observer instead of an error callback */
subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Unsubscribable;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Unsubscribable;
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Unsubscribable;
}

Expand Down

0 comments on commit c85ddf6

Please sign in to comment.