@@ -31,6 +31,7 @@ import warningProps from './utils/warningPropsUtil';
31
31
import type {
32
32
LabeledValueType ,
33
33
SafeKey ,
34
+ Key ,
34
35
DataNode ,
35
36
SimpleModeConfig ,
36
37
ChangeEventExtra ,
@@ -40,7 +41,7 @@ import type {
40
41
LegacyDataNode ,
41
42
} from './interface' ;
42
43
43
- export interface TreeSelectProps < ValueType = any , OptionType extends BaseOptionType = DataNode >
44
+ export interface TreeSelectProps < ValueType = any , OptionType extends DataNode = DataNode >
44
45
extends Omit < BaseSelectPropsWithoutPrivate , 'mode' > {
45
46
prefixCls ?: string ;
46
47
id ?: string ;
@@ -366,7 +367,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
366
367
const displayValues = React . useMemo ( ( ) => {
367
368
// Collect keys which need to show
368
369
const displayKeys = formatStrategyValues (
369
- rawCheckedValues ,
370
+ rawCheckedValues as SafeKey [ ] ,
370
371
mergedShowCheckedStrategy ,
371
372
keyEntities ,
372
373
mergedFieldNames ,
@@ -522,7 +523,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
522
523
const keyList = existRawValues . map ( val => valueEntities . get ( val ) . key ) ;
523
524
524
525
// Conduction by selected or not
525
- let checkedKeys : SafeKey [ ] ;
526
+ let checkedKeys : Key [ ] ;
526
527
if ( selected ) {
527
528
( { checkedKeys } = conductCheck ( keyList , true , keyEntities ) ) ;
528
529
} else {
@@ -536,7 +537,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
536
537
// Fill back of keys
537
538
newRawValues = [
538
539
...missingRawValues ,
539
- ...checkedKeys . map ( key => keyEntities [ key ] . node [ mergedFieldNames . value ] ) ,
540
+ ...checkedKeys . map ( key => keyEntities [ key as SafeKey ] . node [ mergedFieldNames . value ] ) ,
540
541
] ;
541
542
}
542
543
triggerChange ( newRawValues , { selected, triggerValue : selectedValue } , source || 'option' ) ;
@@ -708,7 +709,7 @@ if (process.env.NODE_ENV !== 'production') {
708
709
709
710
const GenericTreeSelect = TreeSelect as unknown as ( <
710
711
ValueType = any ,
711
- OptionType extends BaseOptionType | DataNode = DataNode ,
712
+ OptionType extends DataNode = DataNode ,
712
713
> (
713
714
props : React . PropsWithChildren < TreeSelectProps < ValueType , OptionType > > & {
714
715
ref ?: React . Ref < BaseSelectRef > ;
0 commit comments