From 4c37d650d3b3658963c99b81348fe61f42c9ebbd Mon Sep 17 00:00:00 2001 From: GuanMu Date: Mon, 20 Oct 2025 12:55:37 +0800 Subject: [PATCH] fix: update attribute types to allow undefined values in icon utilities (#27121) --- web/app/components/base/icons/utils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/icons/utils.ts b/web/app/components/base/icons/utils.ts index 632e362075..c00c201bbd 100644 --- a/web/app/components/base/icons/utils.ts +++ b/web/app/components/base/icons/utils.ts @@ -3,13 +3,13 @@ import React from 'react' export type AbstractNode = { name: string attributes: { - [key: string]: string + [key: string]: string | undefined } children?: AbstractNode[] } export type Attrs = { - [key: string]: string + [key: string]: string | undefined } export function normalizeAttrs(attrs: Attrs = {}): Attrs { @@ -24,6 +24,9 @@ export function normalizeAttrs(attrs: Attrs = {}): Attrs { return acc const val = attrs[key] + if (val === undefined) + return acc + key = key.replace(/([-]\w)/g, (g: string) => g[1].toUpperCase()) key = key.replace(/([:]\w)/g, (g: string) => g[1].toUpperCase())