use Parameters<T>

This commit is contained in:
Wu Haotian
2018-12-07 15:53:43 +08:00
parent c05467793e
commit 0920b0ca86
+1 -3
View File
@@ -11,14 +11,12 @@ declare namespace debounce {
}
}
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
declare function debounce<T extends (...args: any[]) => any>(
func: T,
wait?: number,
options?: debounce.DebounceOptions
): (
...args: ArgumentsType<T>
...args: Parameters<T>
) => ReturnType<T> extends Promise<any>
? ReturnType<T>
: Promise<ReturnType<T>>;