fix: update attribute types to allow undefined values in icon utilities (#27121)
This commit is contained in:
@@ -3,13 +3,13 @@ import React from 'react'
|
|||||||
export type AbstractNode = {
|
export type AbstractNode = {
|
||||||
name: string
|
name: string
|
||||||
attributes: {
|
attributes: {
|
||||||
[key: string]: string
|
[key: string]: string | undefined
|
||||||
}
|
}
|
||||||
children?: AbstractNode[]
|
children?: AbstractNode[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Attrs = {
|
export type Attrs = {
|
||||||
[key: string]: string
|
[key: string]: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export function normalizeAttrs(attrs: Attrs = {}): Attrs {
|
export function normalizeAttrs(attrs: Attrs = {}): Attrs {
|
||||||
@@ -24,6 +24,9 @@ export function normalizeAttrs(attrs: Attrs = {}): Attrs {
|
|||||||
return acc
|
return acc
|
||||||
|
|
||||||
const val = attrs[key]
|
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())
|
||||||
key = key.replace(/([:]\w)/g, (g: string) => g[1].toUpperCase())
|
key = key.replace(/([:]\w)/g, (g: string) => g[1].toUpperCase())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user