~/talk

Railway Oriented TypeScript

Talkat Heapcon 2022 · 2022-11-03..11-04· [typescript]
slides:none on file

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

  1. 0:00Introduction and welcome
  2. 0:29Why robustness and maintainability matter
  3. 1:15The problem with happy path code
  4. 2:01Functional programming as a solution
  5. 3:32Why TypeScript for this approach
  6. 5:28Introducing railway-oriented programming
  7. 8:53Two tracks for success and failure
  8. 10:23TypeScript unions and tagged unions
  9. 13:30Rewriting validation with success/failure
  10. 16:46Why TypeScript is essential here
  11. 17:32Self-documenting code benefits
  12. 18:39Transforming functions with two inputs and outputs
  13. 20:10Writing the combine function
  14. 22:54Why not just use promises
  15. 24:27Domain errors vs panics
  16. 25:32Putting it all together with pipe
  17. 26:15Exhaustive error handling
  18. 27:24Real-world use case for translations
  19. 27:53How TypeScript catches mistakes
  20. 28:41Common pitfalls and TypeScript checks
  21. 29:26Libraries for result types
  22. 30:41Conclusion and final thoughts
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.