Skip to content

Commit 5c0b724

Browse files
committed
fix lock and lint
1 parent 32d6951 commit 5c0b724

File tree

2 files changed

+1432
-1836
lines changed

2 files changed

+1432
-1836
lines changed

src/useTimeout.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMemo, useRef } from 'react'
1+
import { MutableRefObject, useMemo, useRef } from 'react'
22
import useMounted from './useMounted'
33
import useWillUnmount from './useWillUnmount'
44

@@ -12,7 +12,11 @@ import useWillUnmount from './useWillUnmount'
1212
*/
1313
const MAX_DELAY_MS = 2 ** 31 - 1
1414

15-
function setChainedTimeout(handleRef, fn, timeoutAtMs) {
15+
function setChainedTimeout(
16+
handleRef: MutableRefObject<any>,
17+
fn: () => void,
18+
timeoutAtMs: number,
19+
) {
1620
const delayMs = timeoutAtMs - Date.now()
1721

1822
handleRef.current =
@@ -50,7 +54,6 @@ export default function useTimeout() {
5054
} else {
5155
setChainedTimeout(handleRef, fn, Date.now() + delayMs)
5256
}
53-
5457
}
5558

5659
return {

0 commit comments

Comments
 (0)