Typing correctly matters
summary
Guidelines emphasize concrete techniques: prefer TypeScript inference over manual annotations, replace optional fields with union types and discriminated unions, and use an assertNever helper so adding a new case fails compilation. For untrusted input generate and validate with JSON Schema to get runtime checks and exact typings, and wrap database rows with ES6 proxies that throw on undefined fields so the declared row type matches queried columns. These practices catch mismatches that types alone miss.
AI-written summary · about
chapters (5)
- 0:00Start
- 0:14Typescript types are statically checked constraints
- 1:58Use discriminated unions
- 3:00Adding runtime checks
- 4:06Leverage Typescript's ability to infer
related talks
22mThink you know TypeScript? Think again.
21mThe long-tail of type safety
21mThe long-tail of type safety
21mBeyond Type Checking Building Bulletproof TypseScript Applications
24mTypeScript for JavaScripties
11mThe Joy of Typescript
21mLearning to Love Type Systems
25mStatic types in JavaScript: what, how and why
