All cheat sheets

JavaScript

TypeScript types cheat sheet

The TypeScript utility types you reach for daily, plus narrowing patterns, template literal types and the modifiers used inside mapped types.

Utility

Narrowing

Advanced

Things worth remembering

  • satisfies checks a value against a type without widening its inferred literal types.
  • as const turns an object or array literal into deeply readonly literal types.
  • Prefer unknown over any: it forces a narrowing check before use.

More JavaScript sheets