param callback param wait returns export function debounce < F extends Function > ( func , wait ) { let timeoutID ; if ( ! Number . isInteger ( wait ) ) { console . warn ( "Called debounce without a valid number" ) ; wait = 300 ; } return < any > function ( this , ... args ) { clearTimeout ( timeoutID ) ; const context = this ; timeoutID = window . setTimeout ( function ( ) { func . apply ( context , args ) ; } , wait ) ; } ; } ;