Skip to main content

NaturalNumbersLessThanOrEqualTo

Type Aliases

NaturalNumbersLessThanOrEqualTo

Ƭ NaturalNumbersLessThanOrEqualTo<N, Acc>: Acc extends [unknown, ...(infer Tail)] ? Tail["length"] extends N ? Acc[number] : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]> : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]>

Helper type to get a range of integers between 0 and N.

From: https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range

Type parameters

NameType
Nextends number
Accextends number[] = []

Defined in

packages/isaacscript-common/src/types/NaturalNumbersLessThanOrEqualTo.ts:7