/** * Options for customizing the debounce function behavior */ export interface DebounceOptions { /** * If true, the debounced function will be invoked on the leading edge of the timeout * instead of the trailing edge */ leading?: boolean; /** * If true, the debounced function will be invoked on the trailing edge of the timeout */ trailing?: boolean; /** * Maximum time the debounced function is allowed to be delayed before it's invoked */ maxWait?: number; } /** * A debounced function that can be invoked, cancelled, and flushed */ export interface DebouncedFunction any> { /** * Invokes the debounced function */ (...args: Parameters): ReturnType | undefined; /** * Cancels any pending invocation of the debounced function */ cancel: () => void; /** * Immediately invokes any pending debounced function call */ flush: () => ReturnType | undefined; /** * Returns true if there's a pending debounced function call */ isPending: () => boolean; } /** * 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 methods to cancel delayed func invocations and to flush them immediately. * Provide options to indicate whether func should be invoked on the leading and/or trailing edge of the wait timeout. * * @param func The function to debounce * @param wait The number of milliseconds to delay * @param options The options object with leading, trailing, and maxWait properties * @returns A debounced version of the function with cancel, flush, and isPending methods */ export declare function debounce any>(func: T, wait?: number, options?: DebounceOptions): DebouncedFunction;