I don't understand the following code example:
IdType extends string
IdType consists out of several value types, how can it extend a string?
const Select = <IdType extends string>(props: {
options: Array<{
id: IdType;
name: string;
}>;
selectedItemId?: IdType;
onSelect: (id: IdType) => void;
}) => (
<select
value={props.selectedItemId ?? ''}
onChange={e => props.onSelect(e.target.value as IdType)}
>
{props.options.map(option => (
<option key={option.id} value={option.id}>
{option.name}
</option>
))}
</
select>
);