I'm a bit confused as to why a1 is evaluated as false
while a2 is considered to be of type boolean
. Can someone explain the reasoning behind this discrepancy?
type Includes<T extends readonly any[], U> = U extends T[number] ? true : false;
type a1 = boolean extends [true, 2, 3, 5, 6, 7] ? true : false;
type a2 = Includes<[true, 2, 3, 5, 6, 7], boolean>