NaturalNumbersLessThan (Type)
Type Aliases
NaturalNumbersLessThan<N, Acc>
type NaturalNumbersLessThan<N, Acc>: Acc["length"] extends N ? Acc[number] : NaturalNumbersLessThan<N, [...Acc, Acc["length"]]>;
Helper type to get a range of integers between 0 and N - 1.
From: https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
Type Parameters
Type Parameter | Default type |
---|---|
N extends number | - |
Acc extends number [] | [] |