mirror of
https://github.com/sindresorhus/type-fest.git
synced 2026-02-01 15:59:43 +00:00
19 lines
563 B
TypeScript
19 lines
563 B
TypeScript
import {expectType, expectError, expectAssignable} from 'tsd';
|
|
import type {IntRange} from '../source/int-range';
|
|
|
|
declare const test: IntRange<0, 5>;
|
|
expectType<0 | 1 | 2 | 3 | 4>(test);
|
|
|
|
declare const startTest: IntRange<5, 10>;
|
|
expectType<5 | 6 | 7 | 8 | 9>(startTest);
|
|
|
|
declare const stepTest1: IntRange<10, 20, 2>;
|
|
expectType<10 | 12 | 14 | 16 | 18>(stepTest1);
|
|
|
|
// Test for step > end - start
|
|
declare const stepTest2: IntRange<10, 20, 100>;
|
|
expectType<10>(stepTest2);
|
|
|
|
declare const maxNumberTest: IntRange<0, 999>;
|
|
expectAssignable<number>(maxNumberTest);
|