Я хотел бы добавить тип, определенный следующим образом, к propTypes:
export type AlarmSeverity =
| 'inactive'
| 'nominal'
| 'caution'
const AlarmLed : FunctionComponent<AlarmLedProps>(severity): React.ReactElement => {...}
export interface AlarmLedProps {
readonly severity: AlarmSeverity;
}
AlarmLed.PropTypes= {
severity: oneOf([
'inactive',
'nominal',
'caution',
]),
}
Этот параметр выдает мне ошибку:
Types of property 'severity' are incompatible.
Type 'string' is not assignable to type 'AlarmSeverity'
У вас есть идея, как мне достичь что или что-то подобное?