Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix-type: TypeScript 定义更新 #1509

Merged
merged 2 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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