From 81875c8c42d2320fa5123b37fee3554f4ca2bddc Mon Sep 17 00:00:00 2001 From: Hikari Hayashi Date: Fri, 30 Oct 2026 00:38:53 +0800 Subject: [PATCH] fix(astro): support stricter optional property checking (#5070) Omit absent className values when calling the shared icon builder so shipped Astro source passes exactOptionalPropertyTypes without changing rendered classes. Enable exactOptionalPropertyTypes and noUncheckedIndexedAccess in the package tsconfig so the existing CI typecheck catches regressions. Background: https://github.com/withastro/astro/issues/18471 Co-authored-by: Codex Co-authored-by: Eric Fennis --- packages/astro/src/Icon.astro | 2 +- packages/astro/tsconfig.json | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/Icon.astro b/packages/astro/src/Icon.astro index a2bacca75..01544fef5 100644 --- a/packages/astro/src/Icon.astro +++ b/packages/astro/src/Icon.astro @@ -28,7 +28,7 @@ const [, builtIconAttributes, builtIconNode = []] = buildLucideIconNode(icon, { strokeWidth, absoluteStrokeWidth, nonScalingStroke, - className, + ...(className !== undefined && { className }), hasA11yProp: hasA11yProp(rest), }); diff --git a/packages/astro/tsconfig.json b/packages/astro/tsconfig.json index 7b837db8c..2e69a2dd0 100644 --- a/packages/astro/tsconfig.json +++ b/packages/astro/tsconfig.json @@ -4,6 +4,8 @@ "module": "ESNext", "moduleResolution": "bundler", "strict": true, + "noUncheckedIndexedAccess": true, + "exactOptionalPropertyTypes": true, "useDefineForClassFields": true, "allowImportingTsExtensions": true, "resolveJsonModule": true,