Skip to content

Commit

Permalink
fix type (alibaba#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhao-huo-long authored Mar 16, 2022
1 parent 9c56695 commit 7c076d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/hooks/src/useDebounceFn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function useDebounceFn<T extends noop>(fn: T, options?: DebounceOptions) {

const debounced = useMemo(
() =>
debounce<T>(
((...args: any[]) => {
debounce(
((...args: Parameters<T>): ReturnType<T> => {
return fnRef.current(...args);
}) as T,
}),
wait,
options,
),
Expand All @@ -34,7 +34,7 @@ function useDebounceFn<T extends noop>(fn: T, options?: DebounceOptions) {
});

return {
run: debounced as unknown as T,
run: debounced,
cancel: debounced.cancel,
flush: debounced.flush,
};
Expand Down
8 changes: 4 additions & 4 deletions packages/hooks/src/useThrottleFn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function useThrottleFn<T extends noop>(fn: T, options?: ThrottleOptions) {

const throttled = useMemo(
() =>
throttle<T>(
((...args: any[]) => {
throttle(
((...args: Parameters<T>): ReturnType<T> => {
return fnRef.current(...args);
}) as T,
}),
wait,
options,
),
Expand All @@ -34,7 +34,7 @@ function useThrottleFn<T extends noop>(fn: T, options?: ThrottleOptions) {
});

return {
run: throttled as unknown as T,
run: throttled,
cancel: throttled.cancel,
flush: throttled.flush,
};
Expand Down

0 comments on commit 7c076d4

Please sign in to comment.