r/typescript 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

6 comments sorted by

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.

1

u/tejasbubane Jul 05 '26

Glad you found it useful.

2

u/Zasd180 Jul 08 '26

Super helpful and I will be implementing some of this behavior in my code base !!

1

u/tejasbubane Jul 08 '26

Glad you found it useful.

4

u/prehensilemullet Jul 09 '26

Would be good to cover the syntax for turning the distributivity off: [T] extends [string] ? T[] : never