Installation
npm install --save @types/debounce-promise
Summary
This package contains type definitions for debounce-promise (https://github.com/bjoerge/debounce-promise).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debounce-promise.
index.d.ts
declare namespace debounce {
interface DebounceOptions {
leading?: boolean | undefined;
accumulate?: boolean | undefined;
}
}
// func is called with an array of array of parameters if accumulate is true
// Use Array<[arg0, arg1, ..., argN]> as func's first parameter type for correct hints
declare function debounce<T extends any[], R>(
func: (args: Array<[...T]>) => R,
wait?: number,
options?: debounce.DebounceOptions & { accumulate: true },
): (
...args: T
) => R extends Promise<any> ? R
: Promise<R>;
declare function debounce<T extends (...args: any[]) => any>(
func: T,
wait?: number | (() => number),
options?: debounce.DebounceOptions,
): (
...args: Parameters<T>
) => ReturnType<T> extends Promise<any> ? ReturnType<T>
: Promise<ReturnType<T>>;
export = debounce;
Additional Details
- Last updated: Mon, 06 Nov 2023 22:41:05 GMT
- Dependencies: none
Credits
These definitions were written by Wu Haotian, and Trevor Robinson.