export const debounce = < T extends ( ... args : any [ ] ) => any > ( callback , waitFor ) => { let timeout ; return ( ... args ) : ReturnType < T > => { let result ; timeout && clearTimeout ( timeout ) ; timeout = setTimeout ( ( ) => { result = callback ( ... args ) ; } , waitFor ) ; return result ; } ; } ;