Type alias FixedLengthTuple<T, N>

FixedLengthTuple<T, N>: N extends N
    ? number extends N
        ? T[]
        : _FixedLengthTuple<T, N, []>
    : never

Fixed length tuple.

Type Parameters

  • T
  • N extends number

Example

const x: FixedLengthTuple<number, 3> = [1, 2, 3]

Source