// Array subclasses that do not compile yet, each refused where it is // declared: a generic subclass, a subclass of a class that extends Array, // a class that declares its own Symbol.species, and a class whose elements // are its own instances. class Bag extends Array { firstOr(fallback: T): T { return this.length > 0 ? this[0]! : fallback; } } class Base extends Array {} class Derived extends Base {} class Speciated extends Array { static get [Symbol.species](): ArrayConstructor { return Array; } } class Nested extends Array {} console.log(new Bag().firstOr(1)); console.log(new Derived().length); console.log(new Speciated().length); console.log(new Nested().length);