Type Alias LooseArrayType<T, Then, Else>

LooseArrayType<T, Then, Else>: IsAnyOrNever<T, {
    $else: T extends readonly any[]
        ? Then
        : Else;
    $then: Else;
}>

🌪️ filter 🚧 temporary

Filter T to ensure it is an array or tuple.

This is a temporary type before ArrayType is adjusted to loose check in the next version.

Type Parameters

  • T
  • Then = T
  • Else = never
type R = LooseArrayType<number[]> // number[]
type R = LooseArrayType<[1]> // [1]
type R = LooseArrayType<number[] | 1> // number[]
type R = LooseArrayType<number[] & 1> // number[]s

type R = LooseArrayType<string> // never