From 989b74f48a6b3be17634b78f02af39577bb18777 Mon Sep 17 00:00:00 2001 From: Ruhani Rabin Date: Wed, 4 Mar 2026 11:10:39 +0800 Subject: [PATCH] fix: Fixed TypeScript error in SettingsModal.tsx --- src/components/SettingsModal.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsx index 233d2d1..d366fe5 100644 --- a/src/components/SettingsModal.tsx +++ b/src/components/SettingsModal.tsx @@ -78,15 +78,16 @@ export function SettingsModal({ open, onClose, soundEnabled, onToggleSound }: Pr } = useTheme(); const { sendOnEnter, toggle: toggleSendShortcut } = useSendShortcut(); const currentLocale = useLocale(); - const [tab, setTab] = useState<'appearance' | 'typography' | 'chat' | 'notifications'>('appearance'); + type TabId = 'appearance' | 'typography' | 'chat' | 'notifications'; + const [tab, setTab] = useState('appearance'); const tabs = useMemo(() => { - const base = [ - { id: 'appearance' as const, label: t('settings.tab.appearance') }, - { id: 'typography' as const, label: t('settings.tab.typography') }, - { id: 'chat' as const, label: t('settings.tab.chat') }, + const base: { id: TabId; label: string }[] = [ + { id: 'appearance', label: t('settings.tab.appearance') }, + { id: 'typography', label: t('settings.tab.typography') }, + { id: 'chat', label: t('settings.tab.chat') }, ]; - if (onToggleSound) base.push({ id: 'notifications' as const, label: t('settings.tab.notifications') }); + if (onToggleSound) base.push({ id: 'notifications', label: t('settings.tab.notifications') }); return base; }, [onToggleSound, t]);