Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 687 Bytes

File metadata and controls

55 lines (39 loc) · 687 Bytes

typelab / assertions / IsIntersected

type IsIntersected<T1, T2> = IfIntersected<T1, T2, true, false>;

Checks if type T1 is intersected with type T2.

Type Parameters

Type Parameter Description

T1

The first type to compare.

T2

The second type to compare.

Returns

true if T1 & T2 is not never, false otherwise.

Example

type Intersected = IsIntersected<'a' | 'c', 'a' | 'b'>; // true
type NotIntersected = IsIntersected<'c', 'a' | 'b'>; // false