Skip to content

Commit

Permalink
fix: 修复setTimeout类型问题
Browse files Browse the repository at this point in the history
  • Loading branch information
heiyehk committed Jan 6, 2022
1 parent f5ee0d0 commit a1b54f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"unpkg": "dist/index.min.js",
"jsdelivr": "dist/index.min.js",
"types": "lib/index.d.ts",
"keywords": ["hyjs", "utils", "tools", "lodash"],
"directories": {
"lib": "lib",
"test": "__tests__"
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type ThrottleEvent = FunctionalControl;
* @returns
*/
export const debounce: DebounceEvent = function (fn, delay = 1000) {
let timer: NodeJS.Timeout | null = null;
let timer: ReturnType<typeof setTimeout> | null = null;
return (...args: any) => {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
Expand Down

0 comments on commit a1b54f5

Please sign in to comment.