Leveraging (algebraic data) types to make your UI rock solid
summary
Claim: modeling UI state with algebraic data types in TypeScript eliminates classes of bugs by making optionality, fallibility and asynchronicity explicit. Tools actually used: Option/Maybe for nested optionality, Result/Either for typed errors (no exceptions), AsyncData to collapse eight bogus object states into four real variants. Built a demo app plus a swan-io/boxed library and examples; code shrinks, the compiler forces exhaustive handling, and runtime glitches around undefined/promises disappear.
AI-written summary · about
chapters (8)
- 0:00Algebraic data types intro
- 3:13UI state management matters
- 5:20Presence with option types
- 11:04Success with result types
- 16:20Completion with async data
- 20:15State management approaches
- 22:24Boxed library for TypeScript
- 23:50Conclusion and key takeaways
related talks
25mLeveraging (algebraic data) types to make your UI rock solid
40mEnhanced safety with types
30mSwipe Left, Uncaught TypeError Learning to Love Type Systems
21mLearning to Love Type Systems
32mCommunicating Intention with Functional TypeScript
36mCommunicating in Types
47mCommunicating in Types
01h 01mAdvanced TypeScript Type Utilities
