Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptstructural typing unsoundnessSingle-choice MCQ

The assignment below type-checks with no error under `--strict`. What does this demonstrate about TypeScript's array typing?

class Animal { name = "a" } class Dog extends Animal { bark() {} } class Cat extends Animal { meow() {} } const dogs: Dog[] = [new Dog()]; const animals: Animal[] = dogs; animals.push(new Cat());