Connect TS types: 12 levels of interfaces, type aliases, intersections and extends. A TypeScript fundamentals game for learning type composition.
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.