From 7c3f79ae7e650afb91efa82d004cbfa04424f3c0 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Sun, 28 Dec 2025 09:00:03 +0100 Subject: [PATCH] fix: TypeScript error in InfoCard icon variant check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix TypeScript build error "Type 'null' cannot be used as an index type" by adding explicit null check for variant before indexing defaultIcons. The variant from VariantProps can be null even with a default value, so TypeScript requires an explicit check. Changes: - Added null check: showDefaultIcon && variant - Added 'as const' to defaultIcons for better type inference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/components/InfoCard.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/InfoCard.tsx b/src/components/InfoCard.tsx index 2ba19d0..40c33d0 100644 --- a/src/components/InfoCard.tsx +++ b/src/components/InfoCard.tsx @@ -103,9 +103,10 @@ function InfoCard({ warning: ExclamationTriangleIcon, error: ExclamationTriangleIcon, success: CheckCircleIcon, - }; + } as const; - const Icon = CustomIcon || (showDefaultIcon ? defaultIcons[variant] : null); + const Icon = + CustomIcon || (showDefaultIcon && variant ? defaultIcons[variant] : null); return (