From e3166c65dffc934f7faf488c96bd17b721020b41 Mon Sep 17 00:00:00 2001 From: Han Yeong-woo Date: Thu, 28 Dec 2023 22:28:15 +0900 Subject: [PATCH] Fix type error of preact `createLucideIcon()` (#1754) Co-authored-by: Eric Fennis --- packages/lucide-preact/src/createLucideIcon.ts | 2 +- packages/lucide-preact/src/defaultAttributes.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/lucide-preact/src/createLucideIcon.ts b/packages/lucide-preact/src/createLucideIcon.ts index 75bfaf8c7..8101577d4 100644 --- a/packages/lucide-preact/src/createLucideIcon.ts +++ b/packages/lucide-preact/src/createLucideIcon.ts @@ -25,7 +25,7 @@ const createLucideIcon = (iconName: string, iconNode: IconNode): FunctionCompone { color = 'currentColor', size = 24, strokeWidth = 2, absoluteStrokeWidth, children, class: classes = '', ...rest }: LucideProps ) => h( - 'svg' as unknown as ComponentType & { 'stroke-width': number | string }>>, + 'svg', { ...defaultAttributes, width: String(size), diff --git a/packages/lucide-preact/src/defaultAttributes.ts b/packages/lucide-preact/src/defaultAttributes.ts index 19adbfc38..9f1b78dbf 100644 --- a/packages/lucide-preact/src/defaultAttributes.ts +++ b/packages/lucide-preact/src/defaultAttributes.ts @@ -1,3 +1,5 @@ +import type { JSX } from 'preact' + export default { xmlns: 'http://www.w3.org/2000/svg', width: 24, @@ -8,4 +10,4 @@ export default { 'stroke-width': '2', 'stroke-linecap': 'round', 'stroke-linejoin': 'round', -}; +} satisfies JSX.SVGAttributes;