interface Params {
// This is what I have right now
model: MsgModel | CmdModel | VcModel
}
class Example extends SomeClass {
constructor() {
super({
name: 'example',
type: 'MSG' // 'MSG' | 'CMD' | 'VC'
})
}
async run({ model }: Params) {
...
}
}
In the above class, how do I set the type of model param based on the value of type in the super call? I want the model to be MsgModel if type is MSG, CmdModel is the type is VC, etc. Here's an example of what SomeClass looks like:
class SomeClass {
constructor({ name, type }: { name: string, type: 'MSG' | 'CMD' | 'VC' }) {
this.name = name;
this.type = type;
}
async run(_params: Params) {
...
}
}