thinking-in-types icon indicating copy to clipboard operation
thinking-in-types copied to clipboard

TypeScript examples to build a mental model for types

Thinking in Types

This is the source code for the article A Mental Model to think in Typescript.

Follow these examples to build a mental model for types:

  • 001: JavaScript Types
  • 002: Simple Sum
  • 003: Primitive
  • 004: Sum all prices
  • 005: Structural vs Nominal Typing
  • 006: Runtime vs Compile time
  • 007: Value space vs Type space
  • 008: Constraints and Type narrowing
  • 009: Immutability in compile time
  • 010: Semantics and Readability
  • 011: Enums
  • 012: Optional Property
  • 013: API Response Optional Property
  • 014: Union Type
  • 015: Intersection Type
  • 016: Tooling