Skip to content

Commit c85ddf6

Browse files
ajcritesbenlesh
authored andcommitted
fix(subscribe): Deprecate null starting parameter signatures for subscribe (#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
1 parent 3cb4cfb commit c85ddf6

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/internal/Observable.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ export class Observable<T> implements Subscribable<T> {
7070
}
7171

7272
subscribe(observer?: PartialObserver<T>): Subscription;
73+
/** @deprecated Use an observer instead of a complete callback */
74+
subscribe(next: null | undefined, error: null | undefined, complete: () => void): Subscription;
75+
/** @deprecated Use an observer instead of an error callback */
76+
subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Subscription;
77+
/** @deprecated Use an observer instead of a complete callback */
78+
subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Subscription;
7379
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
7480
/**
7581
* Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.

src/internal/operators/tap.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import { noop } from '../util/noop';
66
import { isFunction } from '../util/isFunction';
77

88
/* tslint:disable:max-line-length */
9+
/** @deprecated Use an observer instead of a complete callback */
10+
export function tap<T>(next: null | undefined, error: null | undefined, complete: () => void): MonoTypeOperatorFunction<T>;
11+
/** @deprecated Use an observer instead of an error callback */
12+
export function tap<T>(next: null | undefined, error: (error: any) => void, complete?: () => void): MonoTypeOperatorFunction<T>;
13+
/** @deprecated Use an observer instead of a complete callback */
14+
export function tap<T>(next: (value: T) => void, error: null | undefined, complete: () => void): MonoTypeOperatorFunction<T>;
915
export function tap<T>(next?: (x: T) => void, error?: (e: any) => void, complete?: () => void): MonoTypeOperatorFunction<T>;
1016
export function tap<T>(observer: PartialObserver<T>): MonoTypeOperatorFunction<T>;
1117
/* tslint:enable:max-line-length */

src/internal/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ export type SubscribableOrPromise<T> = Subscribable<T> | Subscribable<never> | P
4040

4141
export interface Subscribable<T> {
4242
subscribe(observer?: PartialObserver<T>): Unsubscribable;
43+
/** @deprecated Use an observer instead of a complete callback */
44+
subscribe(next: null | undefined, error: null | undefined, complete: () => void): Unsubscribable;
45+
/** @deprecated Use an observer instead of an error callback */
46+
subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Unsubscribable;
47+
/** @deprecated Use an observer instead of a complete callback */
48+
subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Unsubscribable;
4349
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Unsubscribable;
4450
}
4551

0 commit comments

Comments
 (0)