Is there a way to use an interface based on the value of another key?
So, I would like options to use a particular interface if driver equals a particular value:
- if
driver == 'a'useInterfaceA - if
driver == 'b'useInterfaceB
I thought something like this might work but it doesn't.
export interface InterfaceA {}
export interface InterfaceB {}
export interface MyInterface {
driver: string
root: string
options: driver == 'a' ? InterfaceA : InterfaceB
}