import type {IntRange} from 'type-fest';
type Age = IntRange<0, 20>;
//=> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19
type FontSize = IntRange<10, 20>;
//=> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19
type EvenNumber = IntRange<0, 11, 2>;
//=> 0 | 2 | 4 | 6 | 8 | 10
type RandomNumber = IntRange<0, 100>;
Generate a union of numbers.
The numbers are created from the given
Start(inclusive) parameter to the givenEnd(exclusive) parameter.You skip over numbers using the
Stepparameter (defaults to1). For example,IntRange<0, 10, 2>will create a union of0 | 2 | 4 | 6 | 8.Note:
StartorEndmust be non-negative and smaller than1000.Use-cases: