Annotated solution
Published July 29, 2026The solution
type MyExclude<T, U> = T extends U ? never : TThe common wrong answer
type MyExclude<T, U> = [T] extends [U] ? never : TWrapping T in a tuple switches distribution off, so the whole union is compared at once. ["a" | "b" | "c"] extends ["a"] is false, and the entire union comes back unfiltered.
Line by line
T extends UThere is *naked* — it appears alone on the checked side, not wrapped in a tuple, array or object. That is the exact condition that triggers distribution over a union.? never : TEach member either becomes
neveror survives as itself. Unioning the results drops thenevers automatically, becauseneveris the identity element of union.
Takeaway
Distribution is the difference between asking a question about a union and asking it about each member. [T] extends [U] is the switch that turns it off.

