diff --git a/src/app.d.ts b/src/app.d.ts index f858fd58..9b354164 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -23,17 +23,6 @@ declare global { var native_app: any; } -// @lucide/svelte ≥ 0.577.0 dropped `class` from IconProps — it now derives props purely from -// SVGAttributes, which TypeScript types without `class` (uses `className` instead). -// Every site in the codebase errors without this augmentation. -// If a future lucide update re-adds `class` natively, this becomes a harmless no-op. -// Root cause: @lucide/svelte 0.561.0 → 0.577.0 bump in chore commit 366c6629 (2026-03-10). -declare module '@lucide/svelte' { - interface IconProps { - class?: string; - } -} - // Stripe Buy Button web component — needed so Svelte templates accept the element without TS errors. declare module 'svelte/elements' { interface IntrinsicElements { diff --git a/src/lucide-augment.d.ts b/src/lucide-augment.d.ts new file mode 100644 index 00000000..1b550c68 --- /dev/null +++ b/src/lucide-augment.d.ts @@ -0,0 +1,25 @@ +// Module augmentation to restore `class` prop on @lucide/svelte IconProps. +// +// WHY this file exists and why it is separate from app.d.ts: +// @lucide/svelte ≥ 0.577.0 dropped `class` from IconProps (it now derives props purely from +// SVGAttributes, which TypeScript types without `class`). Every +// in the codebase errors without this. +// +// WHY it cannot live in app.d.ts: +// app.d.ts is a script-context declaration file (no top-level import/export). A +// `declare module 'x' {}` in a script file is an AMBIENT MODULE DECLARATION that completely +// replaces the package's types — not an augmentation. That caused svelte-check to see +// @lucide/svelte as exporting only IconProps, making every icon import a "no exported member" +// error. Putting the declaration here with `export {}` makes this file a module, so +// `declare module` becomes a proper augmentation that merges with the package types. +// +// If a future lucide update re-adds `class` natively, this file becomes a harmless no-op. +// Root cause: @lucide/svelte 0.561.0 → 0.577.0 bump in chore commit 366c6629 (2026-03-10). + +export {}; + +declare module '@lucide/svelte' { + interface IconProps { + class?: string; + } +}