In my app I have BaseObjectInterface and I extend it in many interfaces like AObjInterface, BObjInterface, ect.
Then I have parent interface that has array of BaseObjectInterface in it. I want it to accept all classes that extend base one. For example AObjInterface, BObjInterface, etc. Sadly it doesn't work that way. Can I do it any other way than explicitly listing all types?
What I have:
list: Array<BaseObjectInterface>
What I don't want:
list: Array<AObjInterface|BObjInterface>
What I want put in that list:
[ New BaseObjectInterface(), new AObjInterface(), new BObjInterface()]
If, as you say, BaseObjectInterface is a parent of AObjInterface and BObjInterface, then the type can be just
Array<BaseObjectInterface>. TypeScript Playground example