Skip to content

Commit

Permalink
fix(debounce): improve TypeScript typings with better inference
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Sep 28, 2016
1 parent 28c6433 commit 7bbba73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/extra/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class DebounceOperator<T> implements Operator<T, T> {
* @param {number} period The amount of silence required in milliseconds.
* @return {Stream}
*/
export default function debounce<T>(period: number): (ins: Stream<T>) => Stream<T> {
return function debounceOperator(ins: Stream<T>) {
export default function debounce(period: number): <T>(ins: Stream<T>) => Stream<T> {
return function debounceOperator<T>(ins: Stream<T>) {
return new Stream<T>(new DebounceOperator(period, ins));
};
}
2 changes: 1 addition & 1 deletion tests/extra/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('debounce (extra)', () => {
out.next(5);
},
stop() {}
}
};
const stream = xs.create(producer).compose(debounce(100));
const expected = [5];
let listener = {
Expand Down

0 comments on commit 7bbba73

Please sign in to comment.