Skip to content

QuizNot attempted

interface vs type

Which can ONLY an interface do?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • Declaration merging (two declarations with the same name combine)
  • Only interfaces merge: two interface Window {} declarations combine, which is how libraries let you augment globals and modules
  • a duplicate type is an error.
  • Not unions: only type aliases can be unions.
  • Not mapped/conditional types: also type-alias-only.
  • Not 'extended by a class': a class can implements either an interface or an object-shaped type alias.