← All Exercises

Distributive Conditional Types

advancedtypescript~30min

Background

Distributive conditional types automatically distribute over unions, enabling type-level filtering and mapping.

Problem

Create a distributive conditional type that filters out specific types from a union, and demonstrate it with a mixed union.

Input

A union type containing multiple member types.

Output

A filtered union with specific types removed.

Sample tests

Sample 1

Input: string | number | boolean, filter out boolean
Expected: string | number

Your solution

Learning objective

Understand distributive conditional types and their distribution over union types.