Преглед изворни кода

chore: [TreeSelect] fix virtualList type when strict ts

chenyuling пре 3 година
родитељ
комит
11e63e6ed7
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      packages/semi-ui/treeSelect/index.tsx

+ 2 - 2
packages/semi-ui/treeSelect/index.tsx

@@ -27,7 +27,7 @@ import {
 } from '@douyinfe/semi-foundation/tree/treeUtil';
 } from '@douyinfe/semi-foundation/tree/treeUtil';
 import { cssClasses, strings } from '@douyinfe/semi-foundation/treeSelect/constants';
 import { cssClasses, strings } from '@douyinfe/semi-foundation/treeSelect/constants';
 import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/popover/constants';
 import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/popover/constants';
-import { FixedSizeList as VirtualList } from 'react-window';
+import { FixedSizeList as VirtualList, ListItemKeySelector } from 'react-window';
 import '@douyinfe/semi-foundation/tree/tree.scss';
 import '@douyinfe/semi-foundation/tree/tree.scss';
 import '@douyinfe/semi-foundation/treeSelect/treeSelect.scss';
 import '@douyinfe/semi-foundation/treeSelect/treeSelect.scss';
 import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
 import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
@@ -1166,7 +1166,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
                         itemSize={virtualize.itemSize}
                         itemSize={virtualize.itemSize}
                         height={height}
                         height={height}
                         width={width}
                         width={width}
-                        itemKey={this.itemKey}
+                        itemKey={this.itemKey as ListItemKeySelector<TreeNodeData>}
                         itemData={flattenNodes as any}
                         itemData={flattenNodes as any}
                         className={`${prefixTree}-virtual-list`}
                         className={`${prefixTree}-virtual-list`}
                         style={{ direction }}
                         style={{ direction }}