From 2bc560468d15670a4eedf508aba54a5e0c6da1f8 Mon Sep 17 00:00:00 2001 From: Test Date: Tue, 7 Apr 2026 21:11:20 +0200 Subject: [PATCH] fix: tighten note icon typing --- src/components/DynamicPropertiesPanel.tsx | 6 ++++-- src/utils/noteIcon.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/DynamicPropertiesPanel.tsx b/src/components/DynamicPropertiesPanel.tsx index 847d6a9f..bf249b7d 100644 --- a/src/components/DynamicPropertiesPanel.tsx +++ b/src/components/DynamicPropertiesPanel.tsx @@ -130,8 +130,10 @@ export function DynamicPropertiesPanel({ const handleFocusNoteIcon = () => { const existingIconKey = propertyEntries.find(([key]) => key.toLowerCase() === 'icon')?.[0] - if (!existingIconKey && !onAddProperty) return - if (!existingIconKey) onAddProperty('icon', '') + if (!existingIconKey) { + if (!onAddProperty) return + onAddProperty('icon', '') + } setEditingKey(existingIconKey ?? 'icon') } diff --git a/src/utils/noteIcon.ts b/src/utils/noteIcon.ts index ef5ca17e..08c0150f 100644 --- a/src/utils/noteIcon.ts +++ b/src/utils/noteIcon.ts @@ -18,7 +18,7 @@ function isHttpUrl(value: string): boolean { } } -export function hasNoteIconValue(icon: string | null | undefined): boolean { +export function hasNoteIconValue(icon: string | null | undefined): icon is string { return typeof icon === 'string' && icon.trim().length > 0 }