rxjs throttle this.durationSelector is not a function
angular, ngrx, rxjs, rxjs5, typescript
Solution
Documentation page you're referring on https://github.com/Reactive-Extensions/RxJS is related to RxJS 4. Since you're using Angular2, you're using RxJS 5.
Operator `throttle()` expects as argument an Observable or Promise.
Operator `throttleTime()` takes as argument time in miliseconds.
So you should use `throttleTime(1000)`.
Note that using `.throttle(() => 1000)` is very different. You pass an anonymous function that returns `1000` instead of `1000` number directly. That's why it throws a different error.
Problem
I am trying to `throttle` ngrx store action updates events with the following code ``` import 'rxjs/add/operator/throttle' import { Dispatcher, Store } from '@ngrx/store'; ... static get parameters() { return [[Dispatcher]]; } constructor(actions$) { ... this.actions$ .filter(action => action.type === this.Actions[`LOAD_USERS_REQUEST`]) .throttle(1000 /* ms */) .subscribe(() => ... ); ``` this throws me an error at ThrottleSubscriber.tryDurationSelector (throttle.js:80) TypeError: this.durationSelector is not a function When I replace `.throttle(1000)` with `.throttle(() => 1000)` it throws a different error that clearly shows throttle expects a function, just not the one that I provide. But I wonder why because the documentation states throttle expects a number value. https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/throttle.md