diff --git a/components/select/index.tsx b/components/select/index.tsx index 450f4ec529..47481745f9 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -44,23 +44,23 @@ export interface LabeledValue { export type SelectValue = string | string[] | number | number[] | LabeledValue | LabeledValue[]; -export interface SelectProps extends AbstractSelectProps { - value?: SelectValue; - defaultValue?: SelectValue; +export interface SelectProps extends AbstractSelectProps { + value?: T; + defaultValue?: T; mode?: 'default' | 'multiple' | 'tags' | 'combobox' | string; optionLabelProp?: string; firstActiveValue?: string | string[]; - onChange?: (value: SelectValue, option: React.ReactElement | React.ReactElement[]) => void; - onSelect?: (value: SelectValue, option: React.ReactElement) => any; - onDeselect?: (value: SelectValue) => any; - onBlur?: (value: SelectValue) => void; + onChange?: (value: T, option: React.ReactElement | React.ReactElement[]) => void; + onSelect?: (value: T, option: React.ReactElement) => any; + onDeselect?: (value: T) => any; + onBlur?: (value: T) => void; onFocus?: () => void; onPopupScroll?: React.UIEventHandler; onInputKeyDown?: (e: React.KeyboardEvent) => void; onMouseEnter?: (e: React.MouseEvent) => any; onMouseLeave?: (e: React.MouseEvent) => any; maxTagCount?: number; - maxTagPlaceholder?: React.ReactNode | ((omittedValues: SelectValue[]) => React.ReactNode); + maxTagPlaceholder?: React.ReactNode | ((omittedValues: T[]) => React.ReactNode); optionFilterProp?: string; labelInValue?: boolean; tokenSeparators?: string[]; @@ -102,7 +102,7 @@ const SelectPropTypes = { // => It is needless to export the declaration of below two inner components. // export { Option, OptGroup }; -export default class Select extends React.Component { +export default class Select extends React.Component, {}> { static Option = Option as React.ClassicComponentClass; static OptGroup = OptGroup as React.ClassicComponentClass; @@ -119,7 +119,7 @@ export default class Select extends React.Component { private rcSelect: any; - constructor(props: SelectProps) { + constructor(props: SelectProps) { super(props); warning(