/** * Returns a debounced version of the provided value. * The returned value only updates after the specified delay * has elapsed since the last change. * * @param {T} value - The value to debounce * @param {number} [delay=300] - Debounce delay in milliseconds * @returns {T} The debounced value * * @example * const [query, setQuery] = useState(''); * const debouncedQuery = useDebounce(query, 400); * // debouncedQuery updates 400ms after the last setQuery call */ export declare function useDebounce(value: T, delay?: number): T; /** Options for useDebouncedCallback */ export interface DebouncedCallbackOptions { /** Debounce delay in milliseconds. Default: `300` */ delay?: number; /** Maximum time the callback can be delayed. Default: `undefined` (no limit) */ maxWait?: number; } /** A debounced function with cancel and flush capabilities */ export interface DebouncedFunction unknown> { (...args: Parameters): void; /** Cancel any pending invocation */ cancel: () => void; /** Immediately invoke the pending callback if one exists */ flush: () => void; /** Whether a call is currently pending */ isPending: () => boolean; } /** * Returns a debounced version of the provided callback. * Includes cancel, flush, and isPending controls. * * @param {Function} callback - The function to debounce * @param {number | DebouncedCallbackOptions} [options=300] - Delay in ms or options object * @returns {DebouncedFunction} The debounced function with controls * * @example * const debouncedSearch = useDebouncedCallback( * (term: string) => fetchResults(term), * { delay: 400, maxWait: 2000 }, * ); * debouncedSearch('react'); // calls fetchResults after 400ms * debouncedSearch.cancel(); // cancel pending call */ export declare function useDebouncedCallback unknown>(callback: T, options?: number | DebouncedCallbackOptions): DebouncedFunction;