import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect, 2>>, Expect, 2 | 3>>, Expect, never>>, Expect, 3>>, Expect, 2 | 3>>, Expect, never>>, ]; type ToUnion = T[number]; type Intersect = T & U; type Intersection< T > = T extends [infer First, infer Second, ...infer Tail] ? First extends number[] ? Second extends number[] ? Intersection<[Intersect, ToUnion>, ...Tail]> : Intersection<[Intersect, Second>, ...Tail]> : Intersection<[Intersect, ...Tail]> : T extends [infer Head, ...infer Tail] ? Head extends number[] ? ToUnion : Head : never ;