~/talk

Communicating Intention with Functional TypeScript

Talkat JSConf Budapest 2022 · 2022-06-02..06-03· [typescript]
slides:none on file

Concrete patterns and checks that change code reading into guarantees: use Result/Option discriminated unions to return success or error instead of throwing exceptions, name union members so the compiler enforces exhaustive handling, replace broad any with unknown over any and narrow with type guards, limit strings with literal unions so editors autocomplete status cases, and provide a deep immutable type via mapped generics so nested objects cannot be mutated at runtime thus reducing surprising runtime errors.

AI-written summary · about

  1. 0:00Start
  2. 3:11TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
  3. 5:33What is This Function Doing?
  4. 8:20Error Handling
  5. 8:37Avoiding Throwing Exceptions
  6. 16:29unknown
  7. 18:39function findByGenre(genre: string): Movie[]
  8. 21:20Make Invalid States Impossible to Represent
  9. 26:20What Happened With my Data?
  10. 26:30Immuta... what?
  11. 29:30Final Thoughts and Recap
  12. 30:16Be Honest About Your Function Signatures
  13. 30:47Limit the Scope of Strings
~/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.