Skip to content

Commit d629737

Browse files
committed
ui: Select component supports all subtypes of string.
1 parent 9f1b963 commit d629737

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

components/Select.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import {
66
SelectValue,
77
} from "./SelectBase";
88

9-
interface SelectProps {
10-
optionsType: string,
11-
options: { value: string, label: string, disabled?: boolean }[],
12-
onValueChange: (value: string) => void;
13-
defaultValue?: string,
14-
className?: string,
15-
}
9+
interface SelectProps<T extends string> {
10+
optionsType: string;
11+
options: {value: T; label: string; disabled?: boolean}[];
12+
onValueChange: (value: T) => void;
13+
defaultValue?: T;
14+
className?: string;
15+
}
1616

17-
const Select: React.FC<SelectProps> = ({ optionsType, options, onValueChange, defaultValue, className }) => {
17+
const Select = <T extends string>({ optionsType, options, onValueChange, defaultValue, className }: SelectProps<T>) => {
1818
return (
1919
<div className={className}>
2020
<SelectBase onValueChange={onValueChange} defaultValue={defaultValue}>

0 commit comments

Comments
 (0)