Skip to content

Commit 08c3c9c

Browse files
committed
fix: symbol error
1 parent f5849fa commit 08c3c9c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

components/descriptions/Row.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const Row: FunctionalComponent<RowProps> = props => {
5050
if (typeof component === 'string') {
5151
return (
5252
<Cell
53-
key={`${type}-${key || index}`}
53+
key={`${type}-${String(key) || index}`}
5454
class={className}
5555
style={style}
5656
labelStyle={{ ...rootLabelStyle.value, ...labelStyle }}
@@ -68,7 +68,7 @@ const Row: FunctionalComponent<RowProps> = props => {
6868

6969
return [
7070
<Cell
71-
key={`label-${key || index}`}
71+
key={`label-${String(key) || index}`}
7272
class={className}
7373
style={{ ...rootLabelStyle.value, ...style, ...labelStyle }}
7474
span={1}
@@ -79,7 +79,7 @@ const Row: FunctionalComponent<RowProps> = props => {
7979
label={label}
8080
/>,
8181
<Cell
82-
key={`content-${key || index}`}
82+
key={`content-${String(key) || index}`}
8383
class={className}
8484
style={{ ...rootContentStyle.value, ...style, ...contentStyle }}
8585
span={span * 2 - 1}

components/vc-select/utils/legacyUtil.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ function convertNodeToOption(node: VNode): OptionData {
77
key,
88
children,
99
props: { value, disabled, ...restProps },
10-
} = node as VNode & {
10+
} = node as Omit<VNode, 'key'> & {
1111
children: { default?: () => any };
12+
key: string | number;
1213
};
1314
const child = children && children.default ? children.default() : undefined;
1415
return {
1516
key,
1617
value: value !== undefined ? value : key,
1718
children: child,
1819
disabled: disabled || disabled === '', // support <a-select-option disabled />
19-
...restProps,
20+
...(restProps as Omit<typeof restProps, 'key'>),
2021
};
2122
}
2223

@@ -46,7 +47,7 @@ export function convertChildrenToData(
4647
const child = children && children.default ? children.default() : undefined;
4748
const label = props?.label || children.label?.() || key;
4849
return {
49-
key: `__RC_SELECT_GRP__${key === null ? index : key}__`,
50+
key: `__RC_SELECT_GRP__${key === null ? index : String(key)}__`,
5051
...props,
5152
label,
5253
options: convertChildrenToData(child || []),

0 commit comments

Comments
 (0)