typestar

Types & annotations

23 steps in 7 sets of TypeScript.

The type system as you meet it. Primitives and literal types, then the awkward ones, any and unknown and never, which are worth understanding early because the difference between them is the difference between types that help and types that lie.

Then narrowing, objects and interfaces, functions and tuples, and finally satisfies and the strictness flags. Twenty-three steps, every one typechecked under strict.

Start this tour

Primitives & literals

The awkward types

Narrowing

Objects & interfaces

Functions & tuples

  • Typed functionsParameter, return, and function-type annotations.
  • Function types and overloadsA call signature as a type, optional and default parameters, overloads.
  • TuplesFixed-length arrays with a type per position, and labeled elements.
  • Clamp and lerpClamp and linear interpolation, the two functions every animation needs.
  • Range arrayBuilds an array of numbers, the eager counterpart to a generator.

satisfies & strictness

  • satisfiesCheck a value against a type without widening it to that type.
  • What strict turns onThe individual flags behind strict, shown by what each one catches.

Encore

The other TypeScript tours