Type Matcher — TypeScript

Connect TS types: 12 levels of interfaces, type aliases, intersections and extends. A TypeScript fundamentals game for learning type composition.

What you learn in this game

TypeScript has basic primitive types: string for text, number for numbers, and boolean for true/false. Each value has a matching type.

null means "intentionally empty" and undefined means "not yet given a value". Both have their own type in TypeScript.

An array in TypeScript is written by adding [] after the element type. number[] means an array whose contents are all numbers.

An object type describes the shape of an object: the property names and their value types. { name: string } means an object with a name property of type string.

A union type uses | to say "can be this OR that type". string | number accepts both a string and a number.

A literal type narrows a value down to specific values, not just a general type. "active" | "inactive" only accepts those two strings.

What the levels ask

  1. Connect each type with its matching value.
  2. Connect each type with its matching value.
  3. Connect each array type with its matching value.
  4. Connect each object type with its matching value.
  5. Connect each union type with a valid value.
  6. Connect each literal type with a valid value.
  7. Connect each tuple type with its matching value.
  8. Connect each generic type with its matching value.
  9. Connect each collection type with its matching value.
  10. Connect each utility type with a valid value.
  11. Connect each function type with its implementation.
  12. Connect each advanced type expression with its result.