export const debounce = any>( func: T, delay: number ): ((...args: Parameters) => void) => { let timeoutId: ReturnType; return function (this: ThisParameterType, ...args: Parameters) { clearTimeout(timeoutId); timeoutId = setTimeout(() => func.apply(this, args), delay); }; };