From 20da7bbce9b7df0b9c3633753e214bdd71c315c1 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sat, 2 Nov 2024 02:03:39 +0800 Subject: [PATCH] fix types --- src/renderer/src/App.tsx | 2 +- src/renderer/src/SegmentList.tsx | 2 +- src/renderer/src/contexts.ts | 2 +- src/renderer/src/util/colors.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 1364f0ac..ebedba17 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -473,7 +473,7 @@ function App() { }), [allUserSettings, changeOutDir, effectiveExportMode, toggleCaptureFormat, toggleExportConfirmEnabled, toggleKeyframeCut, toggleSafeOutputFileName, toggleSimpleMode]); const segColorsContext = useMemo(() => ({ - getSegColor: (seg: SegmentColorIndex) => { + getSegColor: (seg: SegmentColorIndex | undefined) => { const color = getSegColor(seg); return preferStrongColors ? color.desaturate(0.2) : color.desaturate(0.6); }, diff --git a/src/renderer/src/SegmentList.tsx b/src/renderer/src/SegmentList.tsx index 15f2be9d..b9907e33 100644 --- a/src/renderer/src/SegmentList.tsx +++ b/src/renderer/src/SegmentList.tsx @@ -338,7 +338,7 @@ function SegmentList({ }, [apparentCutSegments.length, t, updateSegOrder]); function renderFooter() { - const getButtonColor = (seg) => getSegColor(seg).desaturate(0.3).lightness(darkMode ? 45 : 55).string(); + const getButtonColor = (seg: StateSegment | undefined) => getSegColor(seg).desaturate(0.3).lightness(darkMode ? 45 : 55).string(); const currentSegColor = getButtonColor(currentCutSeg); const segAtCursorColor = getButtonColor(segmentAtCursor); diff --git a/src/renderer/src/contexts.ts b/src/renderer/src/contexts.ts index c9183df2..7afbd8ea 100644 --- a/src/renderer/src/contexts.ts +++ b/src/renderer/src/contexts.ts @@ -16,7 +16,7 @@ export type UserSettingsContextType = ReturnType & { } interface SegColorsContextType { - getSegColor: (seg: SegmentColorIndex) => Color + getSegColor: (seg: SegmentColorIndex | undefined) => Color } export const UserSettingsContext = React.createContext(undefined); diff --git a/src/renderer/src/util/colors.ts b/src/renderer/src/util/colors.ts index f0037fc1..a0f99630 100644 --- a/src/renderer/src/util/colors.ts +++ b/src/renderer/src/util/colors.ts @@ -14,7 +14,7 @@ function getColor(n: number) { } // eslint-disable-next-line import/prefer-default-export -export function getSegColor(seg: SegmentColorIndex) { +export function getSegColor(seg: SegmentColorIndex | undefined) { if (!seg) { return color({ h: 0,