Lies We Tell Ourselves Using TypeScript v2
summary
A concise demo shows a fetch from the Star Wars API that compiles yet throws at runtime, exposing how TypeScript is intentionally not provably sound. Ten lines of code produce four distinct bugs — bad fetch typings via res.json, unsafe catch handling, function-overload mismatch, and mutation that widens types when appendEntries mutates a list. Fixes use declaration merging, unknown in catch variables, generics and conditional types, which mitigate each failure but introduce their own trade-offs and hazards.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 0:55Im terribly sorry
- 2:11The code
- 5:03A Tale of Fetch
- 5:56TypeScript at its Boundaries
- 6:36Unsafe Operations
- 9:22Error Handling
- 10:53Unknown to the Rescue
- 11:31Function Overloads
- 17:48Generics
- 19:08Summary
- 20:53More Lies
- 24:59Epilog
related talks
29mThe Lies we Tell Ourselves using TypeScript
30mLies We Tell Ourselves Using TypeScript
30mSwipe Left, Uncaught TypeError Learning to Love Type Systems
01h 01mDeconstructing TypeScript’s Type System
21mThe long-tail of type safety
27mAdvanced TypeScript: elegant solutions to common problems
21mThe long-tail of type safety
42mFriend or Foe? TypeScript Security Fallacies
