Type Alias TailTypesOrUndefined<T, U>

TailTypesOrUndefined<T, U>: T extends []
    ? U
    : T extends [unknown]
        ? U
        : Tail<T>[number]

Returns the union of types in an array, but the first one, uses U as a fallback if the array is empty.

Type Parameters

  • T extends AnyArray
  • U = undefined