//#region src/debounce.d.ts type DebounceOptions = { /** Invoke on the leading edge of the timeout. Defaults to `false`. */ leading?: boolean; /** Maximum time the function can be delayed before it's forced to invoke (in ms). */ maxWait?: number; /** Invoke on the trailing edge of the timeout. Defaults to `true`. */ trailing?: boolean; }; interface DebouncedFunc void> { /** * Call the original function, but applying the debounce rules. * * If the debounced function can be run immediately, this calls it and returns * its return value. * * Otherwise, it returns the return value of the last invocation, or undefined * if the debounced function was not invoked yet. */ (...args: Parameters): ReturnType | undefined; /** Throw away any pending invocation of the debounced function. */ cancel: () => void; /** * If there is a pending invocation of the debounced function, invoke it * immediately and return its return value. * * Otherwise, return the value from the last invocation, or undefined if the * debounced function was never invoked. */ flush: () => ReturnType | undefined; /** Return true if the debounced function still has a scheduled run. */ pending: () => boolean; /** Update the debounced function with a new callback. */ updateCb: (callback: T) => void; /** Update the debounce wait and options while keeping scheduled runs. */ updateParams: (wait: number, options?: DebounceOptions) => void; } declare function debounce void>(func: T, wait: number, options?: DebounceOptions): DebouncedFunc; declare function isDebouncedFn void>(fn: T): fn is T & { cancel: () => void; flush: () => ReturnType | undefined; pending: () => boolean; updateCb: (callback: T) => void; updateParams: (wait: number, options?: DebounceOptions) => void; }; //#endregion export { DebounceOptions, DebouncedFunc, debounce, isDebouncedFn };