It uses the 0 extends 1 & T trick: 1 & T collapses to a type that 0
extends only when T is any (for any other type, 1 & T is 1, a subtype
of 1, or never). This avoids conditional type distribution and does not
require writing any in the implementation.
Checks if a given type
Tis exactly theanytype.It uses the
0 extends 1 & Ttrick:1 & Tcollapses to a type that0extends only whenTisany(for any other type,1 & Tis1, a subtype of1, ornever). This avoids conditional type distribution and does not require writinganyin the implementation.