From 94df449d1276d0607ccd49dc5ed3091265d67f77 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 6 Aug 2024 00:54:20 +0200 Subject: [PATCH] fix types --- src/renderer/src/App.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 44a9bc29..07125062 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -297,7 +297,7 @@ function App() { if (videoRef.current) videoRef.current.volume = playbackVolume; }, [playbackVolume]); - const seekAbs = useCallback((val) => { + const seekAbs = useCallback((val: number | undefined) => { const video = videoRef.current; if (video == null || val == null || Number.isNaN(val)) return; let outVal = val; @@ -438,19 +438,20 @@ function App() { userSeekAbs(videoRef.current!.currentTime + val); }, [userSeekAbs]); - const seekRelPercent = useCallback((val) => { + const seekRelPercent = useCallback((val: number) => { if (!isDurationValid(zoomedDuration)) return; seekRel(val * zoomedDuration); }, [seekRel, zoomedDuration]); const onTimelineWheel = useTimelineScroll({ wheelSensitivity, mouseWheelZoomModifierKey, invertTimelineScroll, zoomRel, seekRel }); - const shortStep = useCallback((direction) => { + const shortStep = useCallback((direction: number) => { // If we don't know fps, just assume 30 (for example if unknown audio file) const fps = detectedFps || 30; // try to align with frame const currentTimeNearestFrameNumber = getFrameCountRaw(fps, videoRef.current!.currentTime); + invariant(currentTimeNearestFrameNumber != null); const nextFrame = currentTimeNearestFrameNumber + direction; userSeekAbs(nextFrame / fps); }, [detectedFps, userSeekAbs]);