ReviseAlgo Logo

Advanced Types

Distributive Conditional Types

Master Distributive Conditional Types in TypeScript, naked type parameters, union distribution, preventing distribution using tuples, and custom union filtering.

Last Updated: July 29, 2026 10 min read

When a conditional type operates on a naked type parameter (a generic parameter T without structural wrapping like [T]), the conditional type automatically distributes over union types.

1. What is Distribution?

When you pass a union type A | B | C to a distributive conditional type ToArray, TypeScript evaluates the conditional check individually for each arm of the union and combines the results back into a union:

2. How Exclude Works Under the Hood

The built-in Exclude utility type relies directly on distributive conditional types:

3. Preventing Distribution (Tuple Wrapping [T])

If you want to evaluate a conditional check on the entire union as a single whole without distributing across individual arms, wrap T and the target type in square brackets [T]:

4. Interactive Code Playground

Test distributive conditional types below:

5. Summary Table

Conditional PatternSyntaxBehavior on string \number
Distributive (Naked)T extends any ? T[] : neverstring[] \number[]
| Non-Distributive (Wrapped) | [T] extends [any] ? T[] : never | (string \| number)[] |