Unions
Exclude
Removes from a union every member assignable to U.
What it is
A distributive conditional type, and the clearest example of what distribution is for. T is a bare type parameter on the left of extends, so the conditional runs once per union member and the results are unioned back — members that match become never and vanish, because never in a union is nothing at all.
Examples
Exclude<'a' | 'b' | 'c', 'b'>→"a" | "c"Exclude<string | number | null, null>→string | numberExclude<'a' | 'b', 'a' | 'b'>→neverExcluding everything leaves
never, which is the correct name for the empty union.
Each resolved type above was printed by TypeScript 6.0.3, not written by hand.
What it does not do
- It does not remove properties from an object.
Excludeworks on unions; the object equivalent isOmit. - It does not require an exact match. Any member *assignable* to
Ugoes, soExclude<string | "a", string>removes both.
Takeaway
If Exclude seems to do nothing, the left side is probably not a union — distribution needs members to distribute over.

