/* * Debounce function that takes a function and a delay time as parameters */ export type DebouncedFunction any> = ( ...args: Parameters ) => void export function debounce any>( func: T, delay: number ): DebouncedFunction { let timeoutId: ReturnType return (...args) => { clearTimeout(timeoutId) timeoutId = setTimeout(() => { func(...args) }, delay) } }