/** * Creates a debounced function that delays invoking func until after wait * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a cancel method to cancel * delayed func invocations and a flush method to immediately invoke them. * * Supports options: { leading, trailing, maxWait } * Drop-in replacement for lodash/debounce. */ export interface DebounceOptions { leading?: boolean; trailing?: boolean; maxWait?: number; } export interface DebouncedFunction any> { (...args: Parameters): ReturnType | undefined; cancel(): void; flush(): ReturnType | undefined; } export default function debounce any>(func: T, wait?: number, options?: DebounceOptions): DebouncedFunction;