export const customDebounce = <T extends (...args: any[]) => any>(
  func: T,
  delay: number
) => {
  let timerId: NodeJS.Timeout;

  return function (this: any, ...args: Parameters<T>) {
    const context = this;

    clearTimeout(timerId);
    timerId = setTimeout(() => {
      func.apply(context, args);
    }, delay);
  };
};
