export function debounce any>(fn: T, ms: number): T { let timeout: ReturnType; return ((...args: any[]) => { clearTimeout(timeout); timeout = setTimeout(() => fn(...args), ms); }) as T; }