mirror of
https://github.com/sindresorhus/type-fest.git
synced 2026-02-01 15:59:43 +00:00
parent
28efb2965c
commit
e75dbe1fee
2
source/int-range.d.ts
vendored
2
source/int-range.d.ts
vendored
@ -8,7 +8,7 @@ The numbers are created from the given `Start` (inclusive) parameter to the give
|
||||
|
||||
You skip over numbers using the `Step` parameter (defaults to `1`). For example, `IntRange<0, 10, 2>` will create a union of `0 | 2 | 4 | 6 | 8`.
|
||||
|
||||
Note: `Start` or `End` must smaller than `1000`.
|
||||
Note: `Start` or `End` must be non-negative and smaller than `1000`.
|
||||
|
||||
Use-cases:
|
||||
1. This can be used to define a set of valid input/output values. for example:
|
||||
|
||||
@ -16,3 +16,10 @@ expectType<10>(stepTest2);
|
||||
|
||||
declare const maxNumberTest: IntRange<0, 999>;
|
||||
expectAssignable<number>(maxNumberTest);
|
||||
|
||||
// Not yet supported.
|
||||
// declare const negative: IntRange<-1, 1>;
|
||||
// expectType<-1 | 0 | 1>(negative);
|
||||
|
||||
// declare const negative2: IntRange<1, -1>;
|
||||
// expectType<-1 | 0 | 1>(negative2);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user