@types/debounce-promise
TypeScript icon, indicating that this package has built-in type declarations

3.1.9 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/debounce-promise

Weekly Downloads

191,758

Version

3.1.9

License

MIT

Unpacked Size

4.48 kB

Total Files

5

Last publish

Collaborators

  • types