Manuals / TypeScript / Ch 5

B · ModelingIntermediate30 min read

5. Checkpoint A — Strict types & unions

TypeScript · 44 pages source format

Before generics and utilities, prove strict setup works and you can model real states with unions. Fix gaps before Phase C.

What you'll learn

  • Type safety self-check

Pass criteria

  • tsconfig strict: true, npm run typecheck script works
  • Core utils converted to .ts with typed params and returns
  • Domain models (User, Post, etc.) in types/models.ts
  • FetchState or Result discriminated union in use
  • Zero any (or each any has // ponytail: escape hatch comment)
  • Can explain type vs interface in one sentence

Do this now

Audit each criterion. Fix failures before continuing.

Clear?

Error reading drill

Copy 3 compiler errors into notes. Write plain English for each. Fix without Stack Overflow if possible.

Do this now

Intentionally break types. Fix from error messages alone.

Clear?

Checklist