Skip to content

Commit

Permalink
fix(typings): relax debounce selector type
Browse files Browse the repository at this point in the history
Closes #3164
  • Loading branch information
cartant committed Jan 13, 2018
1 parent 60f435d commit c419ab4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/internal/operators/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ import { MonoTypeOperatorFunction } from '../../internal/types';
* @method debounce
* @owner Observable
*/
export function debounce<T>(durationSelector: (value: T) => SubscribableOrPromise<number>): MonoTypeOperatorFunction<T> {
export function debounce<T>(durationSelector: (value: T) => SubscribableOrPromise<any>): MonoTypeOperatorFunction<T> {
return (source: Observable<T>) => source.lift(new DebounceOperator(durationSelector));
}

class DebounceOperator<T> implements Operator<T, T> {
constructor(private durationSelector: (value: T) => SubscribableOrPromise<number>) {
constructor(private durationSelector: (value: T) => SubscribableOrPromise<any>) {
}

call(subscriber: Subscriber<T>, source: any): TeardownLogic {
Expand All @@ -74,7 +74,7 @@ class DebounceSubscriber<T, R> extends OuterSubscriber<T, R> {
private durationSubscription: Subscription = null;

constructor(destination: Subscriber<R>,
private durationSelector: (value: T) => SubscribableOrPromise<number>) {
private durationSelector: (value: T) => SubscribableOrPromise<any>) {
super(destination);
}

Expand All @@ -95,7 +95,7 @@ class DebounceSubscriber<T, R> extends OuterSubscriber<T, R> {
this.destination.complete();
}

private _tryNext(value: T, duration: SubscribableOrPromise<number>): void {
private _tryNext(value: T, duration: SubscribableOrPromise<any>): void {
let subscription = this.durationSubscription;
this.value = value;
this.hasValue = true;
Expand Down
2 changes: 1 addition & 1 deletion src/internal/patching/operator/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ import { debounce as higherOrder } from '../../operators/debounce';
* @method debounce
* @owner Observable
*/
export function debounce<T>(this: Observable<T>, durationSelector: (value: T) => SubscribableOrPromise<number>): Observable<T> {
export function debounce<T>(this: Observable<T>, durationSelector: (value: T) => SubscribableOrPromise<any>): Observable<T> {
return higherOrder(durationSelector)(this);
}

0 comments on commit c419ab4

Please sign in to comment.