What is the proper syntax for allowing any type that extends a base type in this specific scenario?
interface SomeBase {}
interface A extends SomeBase {}
interface B extends SomeBase {}
interface Foo {
bar: // Can be an array of A or B
}
Is it simply bar: SomeBase[]
, or is there another way like bar: <? extends SomeBase>
I want to avoid using bar: A[] | B[]
as there may be numerous interfaces and I prefer not to list them all out explicitly.
I couldn't find any clear documentation on how to define it as a variable within an interface.