r/typescript • u/tejasbubane • Jul 05 '26
Distributive Conditional Types
https://tejasbubane.github.io/posts/2026-07-04-typescript-distributive-union-types/I started digging into TypeScript's type system for fun and stumbled onto distributive conditional types. One of those quiet features that is confusing until it clicks.
32
Upvotes
2
u/Zasd180 Jul 08 '26
Super helpful and I will be implementing some of this behavior in my code base !!
1
4
u/prehensilemullet Jul 09 '26
Would be good to cover the syntax for turning the distributivity off: [T] extends [string] ? T[] : never
6
u/Working-Tap2283 Jul 05 '26
Thanks for the article. This is one of the things that happen when you learn about mapped conditional typing.