Skip to content

Commit

Permalink
fix(delayWhen): only deprecates when subscriptionDelay presents (#5797)
Browse files Browse the repository at this point in the history
  • Loading branch information
imcotton authored Oct 6, 2020
1 parent 73fa910 commit 43d1731
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api_guard/dist/types/operators/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export declare function defaultIfEmpty<T, R = T>(defaultValue?: R): OperatorFunc
export declare function delay<T>(due: number | Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;

export declare function delayWhen<T>(delayDurationSelector: (value: T, index: number) => Observable<never>, subscriptionDelay?: Observable<any>): MonoTypeOperatorFunction<T>;
export declare function delayWhen<T>(delayDurationSelector: (value: T, index: number) => Observable<any>, subscriptionDelay?: Observable<any>): MonoTypeOperatorFunction<T>;
export declare function delayWhen<T>(delayDurationSelector: (value: T, index: number) => Observable<any>, subscriptionDelay: Observable<any>): MonoTypeOperatorFunction<T>;
export declare function delayWhen<T>(delayDurationSelector: (value: T, index: number) => Observable<any>): MonoTypeOperatorFunction<T>;

export declare function dematerialize<N extends ObservableNotification<any>>(): OperatorFunction<N, ValueFromNotification<N>>;

Expand Down
5 changes: 5 additions & 0 deletions spec-dtslint/operators/delayWhen-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ it('should enforce types of delayWhenDurationSelector', () => {
it('should enforce types of subscriptiondelayWhen', () => {
const o = of(1, 2, 3).pipe(delayWhen(() => of('a', 'b', 'c'), 'a')); // $ExpectError
});

it('should deprecates', () => {
of(1, 2, 3).pipe(delayWhen(() => NEVER)); // $ExpectDeprecation
of(1, 2, 3).pipe(delayWhen(() => of('a', 'b', 'c'), of(0))); // $ExpectDeprecation
});
5 changes: 4 additions & 1 deletion src/internal/operators/delayWhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export function delayWhen<T>(
/** @deprecated In future versions, `subscriptionDelay` will no longer be supported. */
export function delayWhen<T>(
delayDurationSelector: (value: T, index: number) => Observable<any>,
subscriptionDelay?: Observable<any>
subscriptionDelay: Observable<any>
): MonoTypeOperatorFunction<T>;
export function delayWhen<T>(
delayDurationSelector: (value: T, index: number) => Observable<any>
): MonoTypeOperatorFunction<T>;
/* tslint:disable:max-line-length */

Expand Down

0 comments on commit 43d1731

Please sign in to comment.