UNPKG

460 BTypeScriptView Raw
1import type {GreaterThan} from './greater-than';
2
3/**
4 Returns a boolean for whether a given number is less than or equal to another number.
5
6@example
7```
8import type {LessThanOrEqual} from 'type-fest';
9
10LessThanOrEqual<1, -5>;
11//=> false
12
13LessThanOrEqual<1, 1>;
14//=> true
15
16LessThanOrEqual<1, 5>;
17//=> true
18```
19*/
20export type LessThanOrEqual<A extends number, B extends number> = number extends A | B
21 ? never
22 : GreaterThan<A, B> extends true ? false : true;