mirror of
https://github.com/jhbruhn/respira.git
synced 2026-01-27 02:13:41 +00:00
fix: TypeScript error in InfoCard icon variant check
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 <noreply@anthropic.com>
This commit is contained in:
parent
edb8fa9264
commit
7c3f79ae7e
1 changed files with 3 additions and 2 deletions
|
|
@ -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 (
|
||||
<div className={cn(infoCardVariants({ variant }), className)} {...props}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue