~/talk

Unleashing Conditional Types

Talkat UtahJS Conf 2024 · on Friday, 2024-09-13· [typescript]
links:none on file
slides:none on file

Covers how TypeScript conditional types use extends, distribute over unions, and enable infer-based extraction with concrete examples: a HasID check that yields true/false, non-nullable removing null/undefined from unions, unwrapPromise pulling a promise’s resolved type, and template-literal inference extracting substrings. Shows a recursive type that builds a union of split path segments, a createAttribute pattern enforcing primary/required constraints, and explains that conditional types are powerful for libraries but add complexity and tricky error messages.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:07What are conditional types
  3. 2:56Distributivity with unions
  4. 6:04Understanding infer keyword
  5. 8:56Benefits of conditional types
  6. 11:41Complications and cons
  7. 13:32When to use conditional types
  8. 15:16Library-level use cases
  9. 18:48Summary and Q&A
~/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.