File tree 2 files changed +25
-0
lines changed 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Type definitions for compose-function
2
+ // Project: https://github.com/component/debounce
3
+ // Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+
6
+ declare module "debounce" {
7
+ // Overload on boolean constants would allow us to narrow further,
8
+ // but it is not implemented for TypeScript yet
9
+ function f < A extends Function > ( f : A , interval ?: number , immediate ?: boolean ) : A
10
+ export default f ;
11
+ }
Original file line number Diff line number Diff line change
1
+ /// <reference path="debounce.d.ts" />
2
+
3
+ import debounce = require( "debounce" ) ;
4
+
5
+ const doThings = ( ) => 1 ;
6
+
7
+ debounce ( function ( ) { doThings ( ) ; } ) ( ) ;
8
+
9
+ debounce ( function ( ) { doThings ( ) ; } , 1000 ) ( ) ;
10
+
11
+ debounce ( function ( a : string ) { doThings ( ) ; } , 1000 ) ( "foo" ) ;
12
+
13
+ // Immediate true should return the value
14
+ const imm1 : number = ( debounce ( ( x : number ) => x * 2 , 100 , true ) ) ( 2 ) ;
You can’t perform that action at this time.
0 commit comments