export const debounce = any>(func: F, waitFor: number,) => { let timeout: any; const debounced = (...args: any) => { clearTimeout(timeout) timeout = setTimeout(() => func(...args), waitFor) } return debounced as (...args: Parameters) => ReturnType }