Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptmethod bivariance strictFunctionTypesSingle-choice MCQ

Mutable array covariance — e.g. assigning `Dog[]` to `Animal[]` — is unsound yet allowed even under `strictFunctionTypes`. Internally, why does this slip through?

interface Animal { name: string } interface Dog extends Animal { breed: string } let dogs: Dog[] = []; let animals: Animal[] = []; animals = dogs; // allowed