import React from 'react' ; import { MenuListItem , MenuListItemProps } from '@material/react-menu' ; export type OptionProps < T extends HTMLElement = HTMLElement > = BaseOptionProps & ( T extends HTMLOptionElement ? React . HTMLProps < HTMLOptionElement > : MenuListItemProps < T > ) ; interface BaseOptionProps { enhanced ? : boolean ; } class Option < T extends HTMLElement = HTMLElement > extends React . Component < OptionProps < T > , { } > { static defaultProps = { enhanced : false , } ; render ( ) { const { value , enhanced , children , ... otherProps } = this . props ; if ( enhanced ) { return ( < MenuListItem data - value = { value } { ... otherProps } > { children } < /MenuListItem>); } return ( < option value = { value } { ... otherProps } > { children } < /option>); } } export default Option ;