diff --git a/src/use-retimer/index.ts b/src/use-retimer/index.ts index 5963fa9..2cc0675 100644 --- a/src/use-retimer/index.ts +++ b/src/use-retimer/index.ts @@ -3,11 +3,13 @@ import 'client-only'; import { useCallback, useRef } from 'react'; +type Timer = number | ReturnType; + /** @see https://foxact.skk.moe/use-retimer */ export function useRetimer() { - const timerIdRef = useRef(); + const timerIdRef = useRef(); - return useCallback((timerId?: number | ReturnType) => { + return useCallback((timerId?: Timer) => { if (typeof timerIdRef.current === 'number') { clearTimeout(timerIdRef.current); }