Skip to content

Commit

Permalink
fix(typings): relax throttle selector type
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Jan 13, 2018
1 parent fac9460 commit c75d437
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/internal/operators/throttle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ export const defaultThrottleConfig: ThrottleConfig = {
* @method throttle
* @owner Observable
*/
export function throttle<T>(durationSelector: (value: T) => SubscribableOrPromise<number>,
export function throttle<T>(durationSelector: (value: T) => SubscribableOrPromise<any>,
config: ThrottleConfig = defaultThrottleConfig): MonoTypeOperatorFunction<T> {
return (source: Observable<T>) => source.lift(new ThrottleOperator(durationSelector, config.leading, config.trailing));
}

class ThrottleOperator<T> implements Operator<T, T> {
constructor(private durationSelector: (value: T) => SubscribableOrPromise<number>,
constructor(private durationSelector: (value: T) => SubscribableOrPromise<any>,
private leading: boolean,
private trailing: boolean) {
}
Expand All @@ -88,7 +88,7 @@ class ThrottleSubscriber<T, R> extends OuterSubscriber<T, R> {
private _hasTrailingValue = false;

constructor(protected destination: Subscriber<T>,
private durationSelector: (value: T) => SubscribableOrPromise<number>,
private durationSelector: (value: T) => SubscribableOrPromise<any>,
private _leading: boolean,
private _trailing: boolean) {
super(destination);
Expand Down
2 changes: 1 addition & 1 deletion src/internal/patching/operator/throttle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { throttle as higherOrder, ThrottleConfig, defaultThrottleConfig } from '
* @owner Observable
*/
export function throttle<T>(this: Observable<T>,
durationSelector: (value: T) => SubscribableOrPromise<number>,
durationSelector: (value: T) => SubscribableOrPromise<any>,
config: ThrottleConfig = defaultThrottleConfig): Observable<T> {
return higherOrder(durationSelector, config)(this);
}

0 comments on commit c75d437

Please sign in to comment.