Skip to content

Commit 4c37d65

Browse files
authored
fix: update attribute types to allow undefined values in icon utilities (#27121)
1 parent 1b334e6 commit 4c37d65

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web/app/components/base/icons/utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import React from 'react'
33
export type AbstractNode = {
44
name: string
55
attributes: {
6-
[key: string]: string
6+
[key: string]: string | undefined
77
}
88
children?: AbstractNode[]
99
}
1010

1111
export type Attrs = {
12-
[key: string]: string
12+
[key: string]: string | undefined
1313
}
1414

1515
export function normalizeAttrs(attrs: Attrs = {}): Attrs {
@@ -24,6 +24,9 @@ export function normalizeAttrs(attrs: Attrs = {}): Attrs {
2424
return acc
2525

2626
const val = attrs[key]
27+
if (val === undefined)
28+
return acc
29+
2730
key = key.replace(/([-]\w)/g, (g: string) => g[1].toUpperCase())
2831
key = key.replace(/([:]\w)/g, (g: string) => g[1].toUpperCase())
2932

0 commit comments

Comments
 (0)