Skip to content

Commit 3b38bde

Browse files
committed
fix type
1 parent 9758aed commit 3b38bde

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/TreeSelect.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import warningProps from './utils/warningPropsUtil';
3131
import type {
3232
LabeledValueType,
3333
SafeKey,
34+
Key,
3435
DataNode,
3536
SimpleModeConfig,
3637
ChangeEventExtra,
@@ -40,7 +41,7 @@ import type {
4041
LegacyDataNode,
4142
} from './interface';
4243

43-
export interface TreeSelectProps<ValueType = any, OptionType extends BaseOptionType = DataNode>
44+
export interface TreeSelectProps<ValueType = any, OptionType extends DataNode = DataNode>
4445
extends Omit<BaseSelectPropsWithoutPrivate, 'mode'> {
4546
prefixCls?: string;
4647
id?: string;
@@ -366,7 +367,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
366367
const displayValues = React.useMemo(() => {
367368
// Collect keys which need to show
368369
const displayKeys = formatStrategyValues(
369-
rawCheckedValues,
370+
rawCheckedValues as SafeKey[],
370371
mergedShowCheckedStrategy,
371372
keyEntities,
372373
mergedFieldNames,
@@ -522,7 +523,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
522523
const keyList = existRawValues.map(val => valueEntities.get(val).key);
523524

524525
// Conduction by selected or not
525-
let checkedKeys: SafeKey[];
526+
let checkedKeys: Key[];
526527
if (selected) {
527528
({ checkedKeys } = conductCheck(keyList, true, keyEntities));
528529
} else {
@@ -536,7 +537,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
536537
// Fill back of keys
537538
newRawValues = [
538539
...missingRawValues,
539-
...checkedKeys.map(key => keyEntities[key].node[mergedFieldNames.value]),
540+
...checkedKeys.map(key => keyEntities[key as SafeKey].node[mergedFieldNames.value]),
540541
];
541542
}
542543
triggerChange(newRawValues, { selected, triggerValue: selectedValue }, source || 'option');
@@ -708,7 +709,7 @@ if (process.env.NODE_ENV !== 'production') {
708709

709710
const GenericTreeSelect = TreeSelect as unknown as (<
710711
ValueType = any,
711-
OptionType extends BaseOptionType | DataNode = DataNode,
712+
OptionType extends DataNode = DataNode,
712713
>(
713714
props: React.PropsWithChildren<TreeSelectProps<ValueType, OptionType>> & {
714715
ref?: React.Ref<BaseSelectRef>;

0 commit comments

Comments
 (0)