This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Construct a type that checks if 2 array are interscting | |
type ToUnion<T extends unknown[]> = T[number]; | |
type IntersectionArrays<T extends any[], U extends any[]> = T["length"] extends 0 ? true : | |
{ [K in ToUnion<T>]: K extends ToUnion<U> ? false : true }[ToUnion<T>] extends true ? true : never | |
// Will resolve true since no intersection found | |
type A = IntersectionArrays<[1], [2]> |