Type Alias IsUnion<T, Then, Else>

IsUnion<T, Then, Else>: UnionType.Device<T, Then, Else>

🎭 predicate

Validate the type T is a union.

Type Parameters

  • T
  • Then = true
  • Else = false

Nurbol Alpysbayev

type R = IsUnion<'a' | 'b'> // true
type R = IsUnion<boolean> // true
type R = IsUnion<number> // false