How to model your crazy data in TypeScript
summary
Practical patterns for taming messy API shapes: concrete examples of discriminated unions and reusable type guards, a small version<T, N> helper to evolve API types without copy‑paste, using keyof + indexed types and mapped types to derive nested feature/flag shapes, tuple typing for row arrays, and when to prefer unknown vs any. Demos include real TypeScript snippets, pitfalls with const enums and .d.ts files, and which helpers compile to useful runtime values versus declaration‑only artifacts.
AI-written summary · about
chapters (13)
- 0:00Introduction to TypeScript
- 3:24Modeling data with TypeScript
- 4:13Challenges with product models
- 9:16Handling API versioning
- 14:25Avoiding type pollution
- 18:26Advanced type helpers
- 20:30Nested data structures
- 23:07Working with tuples
- 23:28Using unknown vs any
- 27:34Enums and their pitfalls
- 31:15Where to place types
- 35:46Best practices summary
- 37:11Q&A and resources
related talks
52mTypescript Deep Dive
54mAdvanced TypeScript
01h 01mDeconstructing TypeScript’s Type System
01h 01mAdvanced TypeScript Type Utilities
44mA Deep Dive Into Advanced TypeScript - A Live Coding Expedition
01h 05mBusy TypeScript Developer’s Guide to Advanced TypeScript
22mThink you know TypeScript? Think again.
21mAdvanced TypeScript
