export function debounce void>( func: T, delay: number, ): (...args: any[]) => void { let timeoutId: ReturnType; return function (this: any, ...args: any[]) { // eslint-disable-next-line @typescript-eslint/no-this-alias const context = this; clearTimeout(timeoutId); timeoutId = setTimeout(() => { func.apply(context, args); }, delay); }; }