diff --git a/components/select/index.tsx b/components/select/index.tsx index 38dea526b0..7d7b68fa9b 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -51,17 +51,18 @@ export interface LabeledValue { export type SelectValue = string | string[] | number | number[] | LabeledValue | LabeledValue[]; -export type ModeOptions = - | 'SECRET_COMBOBOX_MODE_DO_NOT_USE' - | 'default' - | 'multiple' - | 'tags' - | 'combobox' - | undefined; +const ModeOptions = tuple( + 'default', + 'multiple', + 'tags', + 'combobox', + 'SECRET_COMBOBOX_MODE_DO_NOT_USE', +); +export type ModeOption = (typeof ModeOptions)[number]; export interface SelectProps extends AbstractSelectProps { value?: T; defaultValue?: T; - mode?: ModeOptions; + mode?: ModeOption; optionLabelProp?: string; firstActiveValue?: string | string[]; onChange?: (value: T, option: React.ReactElement | React.ReactElement[]) => void; @@ -121,7 +122,7 @@ export default class Select extends React.Component; - static SECRET_COMBOBOX_MODE_DO_NOT_USE: ModeOptions = 'SECRET_COMBOBOX_MODE_DO_NOT_USE'; + static SECRET_COMBOBOX_MODE_DO_NOT_USE: ModeOption = 'SECRET_COMBOBOX_MODE_DO_NOT_USE'; static defaultProps = { showSearch: false,