const enum ColumnValues {
one = 1,
two = 2,
three = 3,
}
interface Props {
style?: StyleProp<ViewStyle>;
title?: string;
titleContainerStyle?: StyleProp<ViewStyle>;
titleStyle?: StyleProp<TextStyle>;
textInputStyle?: StyleProp<TextStyle>;
column?: ColumnValues.one | ColumnValues.two | ColumnValues.three;
}
const DynPut: FC<Props> = Props => {
...
return(
...
)
I have integrated this DynPut into another component and input the value of 10 to the Column Prop, however Typescript is not generating any errors. How can I configure Typescript to throw an error when a value greater than 3 is supplied to the Column Prop?
<DynPut
title="Add Items"
style={{backgroundColor: 'yellow'}}
titleStyle={{backgroundColor: 'green'}}
titleContainerStyle={{backgroundColor: 'green'}}
textInputStyle={{borderWidth: 5}}
column={10}
/>