// deno-lint-ignore no-explicit-any export type Wrapper = void>( fn: T, ) => (...args: Parameters) => void; export const debounce = (delay: number): Wrapper => { return (func) => { let timeout: ReturnType | null = null; return (...args: Parameters) => { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(() => { func(...args); }, delay); }; }; };