// eslint disabled on entire file because we don't want to enforce prop types
// this is a utility function that should be used in a component that already has prop types
// and we don't want to force prop types on this utility function
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
 * Debounce a function, making it only callable after a certain amount of time has passed.
 * @param func The function to debounce.
 * @param timeout The amount of time to wait before calling the function.
 * @returns A debounced version of the function.
 * @template Params The parameters of the function.
 * @example
 * ```tsx
 * const debouncedFunction = debounce((...args) => {
 *  console.log(args);
 * }, 1000);
 * debouncedFunction(1);
 * ```
 */
export function debounce(func, timeout) {
    let timer;
    return (...args) => {
        if (timer) {
            clearTimeout(timer);
        }
        timer = setTimeout(() => {
            func(...args);
        }, timeout);
    };
}
//# sourceMappingURL=debounce.js.map