Type Alias IsIndexOutOfBound<A, N, Then, Else>

IsIndexOutOfBound<A, N, Then, Else>: IsNever<IndexAt<A, N, never, never, never>, {
    $else: Else;
    $then: Then;
}>

🎭 predicate

Is N an out of bound index of A.

Type Parameters

  • A extends readonly unknown[]
  • N extends number
  • Then = true
  • Else = false
type R = IsIndexOutOfBound<[1], 0> // false
type R = IsIndexOutOfBound<[1], -1> // false

type R = IsIndexOutOfBound<[1], 1> // true
type R = IsIndexOutOfBound<[1], -2> // true