Skip to content

Commit 3bf208b

Browse files
authored
fix: fix onSelect type definition (#704)
1 parent 3b94e1b commit 3bf208b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Select.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ export interface DefaultOptionType extends BaseOptionType {
9191
children?: Omit<DefaultOptionType, 'children'>[];
9292
}
9393

94+
export type SelectHandler<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType> =
95+
| ((value: RawValueType | LabelInValueType, option: OptionType) => void)
96+
| ((value: ValueType, option: OptionType) => void);
97+
9498
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType>
9599
extends BaseSelectPropsWithoutPrivate {
96100
prefixCls?: string;
@@ -109,8 +113,8 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
109113
autoClearSearchValue?: boolean;
110114

111115
// >>> Select
112-
onSelect?: (value: RawValueType | LabelInValueType, option: OptionType) => void;
113-
onDeselect?: (value: RawValueType | LabelInValueType, option: OptionType) => void;
116+
onSelect?: SelectHandler<ValueType, OptionType>;
117+
onDeselect?: SelectHandler<ValueType, OptionType>;
114118

115119
// >>> Options
116120
/**

0 commit comments

Comments
 (0)