From 309f440724cfb62a0bdd215c9cf4bfca79b532ae Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Fri, 2 Oct 2026 13:15:43 +0200 Subject: [PATCH] fix(lucide-preact): add Preact v11 compatibility (#4924) * fix(lucide-preact): import `SVGAttributes` and `SignalLike` from `preact` `LucideProps` extended `JSX.SVGAttributes` and `createLucideIcon` used `JSX.SignalLike`. Preact 10 marks both JSX aliases as deprecated in favour of the top-level exports, and Preact 11 removes them: its `JSX` namespace only keeps what TypeScript needs for JSX checking. Against Preact 11 the package fails `tsc` (TS2694), and the published `.d.ts` resolves `LucideProps` to an error type. Consumers with `skipLibCheck: true` see no error, but every icon then accepts unknown props and event handler parameters become implicit `any`. The top-level `SVGAttributes` and `SignalLike` exports already exist in Preact 10.27.2, the current peer floor, and are identical to the JSX aliases there, so the props type does not change for Preact 10 users. * fix(lucide-preact): add Preact v11 compatibility Widen the `preact` peer range to `^10.27.2 || ^11.0.0-0`. The `-0` lets the 11.0.0 release candidates install without peer warnings and still covers every 11.x release. The dev dependency stays on Preact 10. The lockfile does not record workspace peer ranges, so it is unchanged. --- packages/lucide-preact/package.json | 2 +- packages/lucide-preact/src/createLucideIcon.ts | 4 ++-- packages/lucide-preact/src/types.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/lucide-preact/package.json b/packages/lucide-preact/package.json index c0637adf2..62384c1bb 100644 --- a/packages/lucide-preact/package.json +++ b/packages/lucide-preact/package.json @@ -62,6 +62,6 @@ "vite": "^7.3.6" }, "peerDependencies": { - "preact": "^10.27.2" + "preact": "^10.27.2 || ^11.0.0-0" } } diff --git a/packages/lucide-preact/src/createLucideIcon.ts b/packages/lucide-preact/src/createLucideIcon.ts index 8df381af5..4cb1353f6 100644 --- a/packages/lucide-preact/src/createLucideIcon.ts +++ b/packages/lucide-preact/src/createLucideIcon.ts @@ -1,4 +1,4 @@ -import { h, JSX } from 'preact'; +import { h, type SignalLike } from 'preact'; import { mergeClasses, toLucideIconData, toPascalCase } from '@lucide/shared'; import Icon from './Icon'; import type { LucideIcon, LucideIconData, LucideIconNode, LucideProps } from './types'; @@ -41,7 +41,7 @@ function createLucideIcon( { ...props, icon: iconData, - class: mergeClasses>(classes, className), + class: mergeClasses>(classes, className), }, children, ); diff --git a/packages/lucide-preact/src/types.ts b/packages/lucide-preact/src/types.ts index 15204ae36..c6d6f7de7 100644 --- a/packages/lucide-preact/src/types.ts +++ b/packages/lucide-preact/src/types.ts @@ -1,4 +1,4 @@ -import { type FunctionComponent, type JSX } from 'preact'; +import { type FunctionComponent, type SVGAttributes } from 'preact'; import type { LucideIconData as SharedLucideIconData, LucideIconNode as SharedLucideIconNode, @@ -13,7 +13,7 @@ export type LucideIconData = SharedLucideIconData; */ export type IconNode = LucideIconNode[]; -export interface LucideProps extends Partial> { +export interface LucideProps extends Partial> { color?: string; size?: string | number; width?: string | number;