Subsequent calls to the debounced function debounced.callback return the result of the last func invocation. Note, that if there are no previous invocations it's mean you will get undefined. You should check it in your code properly.

interface DebouncedState<T extends (...args: value[]) => ReturnType<T>> {
    callback: (...args: Parameters<T>) => ReturnType<T>;
    cancel: () => void;
    flush: () => void;
    pending: () => boolean;
}

Type Parameters

  • T extends (...args: value[]) => ReturnType<T>

Hierarchy (View Summary)

Properties

callback: (...args: Parameters<T>) => ReturnType<T>
cancel: () => void
flush: () => void
pending: () => boolean