~/talk

TypeScript's Conditional Types | Hard shell soft core

Talkat RuhrJS 2019 · 2019-10-05..10-06· [typescript]
slides:none on file

Explains that conditional types as ternary expressions let TypeScript 2.8+ choose return types, shows infer to extract nested properties so a factory’s method signature becomes a different function when a payload property exists, and demonstrates using never and unknown for omission and safety plus helpers like exclude/extract. Shows a real typed factory (createCommand) that changes parameter requirements based on payload presence and describes running compile-time checks with a small tool that compiles TypeScript snippets as tests.

AI-written summary · about

  1. 0:00Start
  2. 0:51The Dynamic Type System
  3. 7:50Conditional Types
  4. 10:22Benefits of Conditional Types
  5. 11:55Ways To Test Conditional Types
  6. 14:27Restricting Types
  7. 16:03Unknown Type
  8. 16:43Types Constraint
  9. 28:22Tia Snippet
  10. 29:07Typescript Strict Mode
~/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.