From bae2ca288f9e32e6efcdac63cbe7bc2851e10525 Mon Sep 17 00:00:00 2001 From: Anton Gunnarsson Date: Wed, 28 Jan 2026 14:52:59 +0000 Subject: [PATCH] Merged in chore/fix-material-icons-types (pull request #3497) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chore: Fix MaterialIconName type * Fix MaterialIconName type Approved-by: Bianca Widstam Approved-by: Matilda Landström --- .../components/Icons/MaterialIcon/generated.tsx | 13 ++++++++----- scripts/material-symbols-update.mts | 15 +++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/design-system/lib/components/Icons/MaterialIcon/generated.tsx b/packages/design-system/lib/components/Icons/MaterialIcon/generated.tsx index f8254cd05..20f197a76 100644 --- a/packages/design-system/lib/components/Icons/MaterialIcon/generated.tsx +++ b/packages/design-system/lib/components/Icons/MaterialIcon/generated.tsx @@ -430,15 +430,16 @@ import YardOutlined from "./generated/YardOutlined" import YardFilled from "./generated/YardFilled" type SvgIcon = FunctionComponent> - -export const materialIcons: Record< +type IconMap = Record< string, Partial<{ outlined: { outlined: SvgIcon; filled?: SvgIcon } rounded: { outlined: SvgIcon; filled?: SvgIcon } sharp: { outlined: SvgIcon; filled?: SvgIcon } }> -> = { +> + +const _materialIcons = { accessibility: { outlined: { outlined: AccessibilityOutlined, filled: AccessibilityFilled }, }, @@ -985,6 +986,8 @@ export const materialIcons: Record< }, wifi: { outlined: { outlined: WifiOutlined, filled: WifiFilled } }, yard: { outlined: { outlined: YardOutlined, filled: YardFilled } }, -} +} satisfies IconMap -export type MaterialIconName = keyof typeof materialIcons +export const materialIcons = _materialIcons as IconMap + +export type MaterialIconName = keyof typeof _materialIcons diff --git a/scripts/material-symbols-update.mts b/scripts/material-symbols-update.mts index 0dd1afc3f..54e37d4ab 100644 --- a/scripts/material-symbols-update.mts +++ b/scripts/material-symbols-update.mts @@ -349,19 +349,22 @@ import type { FunctionComponent, SVGProps } from "react" ${imports.join("\n")} type SvgIcon = FunctionComponent> - -export const materialIcons: Record< +type IconMap = Record< string, Partial<{ outlined: { outlined: SvgIcon; filled?: SvgIcon } rounded: { outlined: SvgIcon; filled?: SvgIcon } sharp: { outlined: SvgIcon; filled?: SvgIcon } }> -> = { -${registryEntries.join("\n")} -} +> -export type MaterialIconName = keyof typeof materialIcons +const _materialIcons = { +${registryEntries.join("\n")} +} satisfies IconMap + +export const materialIcons = _materialIcons as IconMap + +export type MaterialIconName = keyof typeof _materialIcons `.trim() + "\n" await writeFile(OUT, content, "utf8")