export default function debounce( callback: T, durationMs = 10, ) { let timeoutId: NodeJS.Timeout | null = null const callable = (...args: any) => { if (timeoutId !== null) clearTimeout(timeoutId) timeoutId = setTimeout(() => { callback(...args) }, durationMs) } return callable as unknown as T }