Advanced Vocabulary #typescript #type-system #utility-types #type-narrowing

TypeScript — Advanced Types

5 exercises — interface vs type alias, discriminated unions with exhaustive checking, built-in utility types, type narrowing, and reading TypeScript compiler errors in plain English.

0 / 5 completed
TypeScript advanced type vocabulary reference
  • interface — object shape; supports declaration merging and extends
  • type alias — name for any type; required for unions, intersections, mapped types
  • discriminated union — union with a shared literal "discriminant" field for safe narrowing
  • utility typesPartial<T>, Pick<T,K>, Omit<T,K>, Required<T>, Readonly<T>
  • type narrowing — TypeScript narrowing a union to a specific type inside a conditional
  • type predicate (x is T) — user-defined type guard return type
1 / 5
During a TypeScript code review, a reviewer comments: "Prefer an interface over a type alias here — this shape needs to be extendable." What is the key difference that makes the reviewer favour interface?