Unleashing Conditional Types
summary
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
chapters (9)
- 0:00Introduction to talk
- 1:07What are conditional types
- 2:56Distributivity with unions
- 6:04Understanding infer keyword
- 8:56Benefits of conditional types
- 11:41Complications and cons
- 13:32When to use conditional types
- 15:16Library-level use cases
- 18:48Summary and Q&A
related talks
52mTypescript Deep Dive
33mTypeScript's Conditional Types | Hard shell soft core
54mAdvanced TypeScript
01h 33mAdvanced TypeScript
24mTypeScript for JavaScripties
01h 05mBusy TypeScript Developer’s Guide to Advanced TypeScript
01h 01mDeconstructing TypeScript’s Type System
27mDecoding Perplexing TypeScript
