Type Alias ArrayFixedLength<T, L, R>

ArrayFixedLength<T, L, R>: R["length"] extends L
    ? R
    : ArrayFixedLength<T, L, [...R, T]>

array of type T, and fixed length L
technique copied from stackexchange, user "mstephen19"
the R generic is for recursion, and not intended for external use.

Type Parameters

  • T
  • L extends number
  • R extends T[] = []