| | |
| | | */ |
| | | trailing?: boolean | undefined; |
| | | } |
| | | interface DebounceSettingsLeading extends DebounceSettings { |
| | | leading: true; |
| | | } |
| | | interface DebouncedFunc<T extends (...args: any[]) => any> { |
| | | /** |
| | | * Call the original function, but applying the debounce rules. |
| | |
| | | */ |
| | | flush(): ReturnType<T> | undefined; |
| | | } |
| | | interface DebouncedFuncLeading<T extends (...args: any[]) => any> extends DebouncedFunc<T> { |
| | | (...args: Parameters<T>): ReturnType<T>; |
| | | flush(): ReturnType<T>; |
| | | } |
| | | interface LoDashStatic { |
| | | /** |
| | | * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since |
| | |
| | | * @param options.trailing Specify invoking on the trailing edge of the timeout. |
| | | * @return Returns the new debounced function. |
| | | */ |
| | | debounce<T extends (...args: any) => any>(func: T, wait: number | undefined, options: DebounceSettingsLeading): DebouncedFuncLeading<T>; |
| | | debounce<T extends (...args: any) => any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc<T>; |
| | | } |
| | | interface Function<T extends (...args: any) => any> { |
| | | /** |
| | | * @see _.debounce |
| | | */ |
| | | debounce( |
| | | wait: number | undefined, |
| | | options: DebounceSettingsLeading |
| | | ): T extends (...args: any[]) => any ? Function<DebouncedFuncLeading<T>> : never; |
| | | debounce( |
| | | wait?: number, |
| | | options?: DebounceSettings |
| | |
| | | * @see _.debounce |
| | | */ |
| | | debounce( |
| | | wait: number | undefined, |
| | | options: DebounceSettingsLeading |
| | | ): T extends (...args: any[]) => any ? FunctionChain<DebouncedFuncLeading<T>> : never; |
| | | debounce( |
| | | wait?: number, |
| | | options?: DebounceSettings |
| | | ): T extends (...args: any[]) => any ? FunctionChain<DebouncedFunc<T>> : never; |