Suppose I have an abstract class named Conditions
, which is then extended by classes like BoolCondtions
, TextConditions
, and more.
In addition, I am using an interface structured as follows:
export interface ConditionModel {type: string; class: Conditions}
However, when I attempt to create an object using this model, TypeScript throws an error stating that BoolConditions
is incompatible with Conditions
:
export const myConditions: ConditionModel[] = {
{type: 'bool', class: BoolConditions},
{type: 'text', class: TextConditions},
}
Does TypeScript not support extending classes in this scenario?