1 | import type {NumberAbsolute, PositiveNumericStringGt} from './internal';
|
2 | import type {IsEqual} from './is-equal';
|
3 | import type {PositiveInfinity, NegativeInfinity, IsNegative} from './numeric';
|
4 | import type {And} from './and';
|
5 | import type {Or} from './or';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export type GreaterThan<A extends number, B extends number> = number extends A | B
|
25 | ? never
|
26 | : [
|
27 | IsEqual<A, PositiveInfinity>, IsEqual<A, NegativeInfinity>,
|
28 | IsEqual<B, PositiveInfinity>, IsEqual<B, NegativeInfinity>,
|
29 | ] extends infer R extends [boolean, boolean, boolean, boolean]
|
30 | ? Or<
|
31 | And<IsEqual<R[0], true>, IsEqual<R[2], false>>,
|
32 | And<IsEqual<R[3], true>, IsEqual<R[1], false>>
|
33 | > extends true
|
34 | ? true
|
35 | : Or<
|
36 | And<IsEqual<R[1], true>, IsEqual<R[3], false>>,
|
37 | And<IsEqual<R[2], true>, IsEqual<R[0], false>>
|
38 | > extends true
|
39 | ? false
|
40 | : true extends R[number]
|
41 | ? false
|
42 | : [IsNegative<A>, IsNegative<B>] extends infer R extends [boolean, boolean]
|
43 | ? [true, false] extends R
|
44 | ? false
|
45 | : [false, true] extends R
|
46 | ? true
|
47 | : [false, false] extends R
|
48 | ? PositiveNumericStringGt<`${A}`, `${B}`>
|
49 | : PositiveNumericStringGt<`${NumberAbsolute<B>}`, `${NumberAbsolute<A>}`>
|
50 | : never
|
51 | : never;
|