i have a props that looks like:
{
option1,
option2,
option3,
option4,
general,
otheprops
}
what i want is to make it that only only one option can be used at giving time what i have as types :
interface MyTypes {
option1: boolean
option2: boolean
option3: boolean
general: boolean
otherprops: string
}
What i tried to do is:
interface GeneralTypes{
general: boolean
otherprops: string
}
interface Option1Types{
option1: boolean
}
interface Option2Types{
option2: boolean
}
interface Option3Types{
option3: boolean
}
type MyTypes = GeneralTypes & ( Option1Types | Option2Types |Option3Types )
but i get this error
Property 'option1' does not exist on type '(GeneralTypes & Option1) | (GeneralTypes & Option2)| (GeneralTypes & Option3) '
Property 'option2' does not exist on type '(GeneralTypes & Option1) | (GeneralTypes & Option2)| (GeneralTypes & Option3) '
Property 'option3' does not exist on type '(GeneralTypes & Option1) | (GeneralTypes & Option2)| (GeneralTypes & Option3) '