I am trying to type an existing React Native module with the following props:
useComponent1: boolean
useComponent2: boolean
With the following implementation
render(){
if(useComponent1){
return <Component1 {...props}/>
}
if(useComponent2){
return <Component2 {...props}/>
}
}
I have an interface for components 1 & 2, however, I can't extend both as the props are determined by which component is utilised.
Is it possible to dynamically extends an interface?
If not, is there another solution to this issue?