function throttle any>( fn: Fn, ms: number ): (...args: Parameters) => void { let throttledFn = () => undefined; let throttled: boolean = false; return (...args: Parameters): void => { throttledFn = () => fn(...args); if (throttled) return; setTimeout(() => { throttledFn(); throttled = false; }, ms); throttled = true; }; } export default throttle;