Railway Oriented TypeScript
summary
Shows a concrete pattern: wrap every step as a tagged union Result type (success or failure) and compose them with a small pipe plus two combinators (chain to forward successes, tap for logging) so failures ride a separate success/failure two-track model instead of throwing. TypeScript enforces exhaustive checks and flags a forgotten chain or type mismatch at compile time. Demonstrates plain-TS implementation, cites fp-ts (Either) as a ready library, and publishes the working code as a gist.
AI-written summary · about
chapters (22)
- 0:00Introduction and welcome
- 0:29Why robustness and maintainability matter
- 1:15The problem with happy path code
- 2:01Functional programming as a solution
- 3:32Why TypeScript for this approach
- 5:28Introducing railway-oriented programming
- 8:53Two tracks for success and failure
- 10:23TypeScript unions and tagged unions
- 13:30Rewriting validation with success/failure
- 16:46Why TypeScript is essential here
- 17:32Self-documenting code benefits
- 18:39Transforming functions with two inputs and outputs
- 20:10Writing the combine function
- 22:54Why not just use promises
- 24:27Domain errors vs panics
- 25:32Putting it all together with pipe
- 26:15Exhaustive error handling
- 27:24Real-world use case for translations
- 27:53How TypeScript catches mistakes
- 28:41Common pitfalls and TypeScript checks
- 29:26Libraries for result types
- 30:41Conclusion and final thoughts
related talks
33mRailway Oriented TypeScript
32mCommunicating Intention with Functional TypeScript
30mRust-Inspired Typescript
21mSuper TypeScript II Turbo – FP Remix
43mA Deep Dive into Advanced TypeScript: A Live Coding Expedition
20mBetter Together: Rust & TypeScript
01h 05mBusy TypeScript Developer’s Guide to Advanced TypeScript
51mTypeScript - Beyond the Basics
