@fncts/typelevel 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/Any.d.ts +48 -0
  2. package/Boolean.d.ts +39 -0
  3. package/BuiltIn.d.ts +3 -0
  4. package/Check.d.ts +70 -0
  5. package/Function.d.ts +11 -0
  6. package/HKT.d.ts +186 -0
  7. package/Intersection.d.ts +1 -0
  8. package/Iteration.d.ts +216 -0
  9. package/List.d.ts +15 -0
  10. package/Number.d.ts +56 -0
  11. package/Object.d.ts +118 -0
  12. package/String.d.ts +8 -0
  13. package/Union.d.ts +23 -0
  14. package/_cjs/Any.cjs +6 -0
  15. package/_cjs/Any.cjs.map +1 -0
  16. package/_cjs/Boolean.cjs +6 -0
  17. package/_cjs/Boolean.cjs.map +1 -0
  18. package/_cjs/BuiltIn.cjs +6 -0
  19. package/_cjs/BuiltIn.cjs.map +1 -0
  20. package/_cjs/Check.cjs +6 -0
  21. package/_cjs/Check.cjs.map +1 -0
  22. package/_cjs/Function.cjs +6 -0
  23. package/_cjs/Function.cjs.map +1 -0
  24. package/_cjs/HKT.cjs +26 -0
  25. package/_cjs/HKT.cjs.map +1 -0
  26. package/_cjs/Intersection.cjs +6 -0
  27. package/_cjs/Intersection.cjs.map +1 -0
  28. package/_cjs/Iteration.cjs +6 -0
  29. package/_cjs/Iteration.cjs.map +1 -0
  30. package/_cjs/List.cjs +6 -0
  31. package/_cjs/List.cjs.map +1 -0
  32. package/_cjs/Number.cjs +6 -0
  33. package/_cjs/Number.cjs.map +1 -0
  34. package/_cjs/Object.cjs +6 -0
  35. package/_cjs/Object.cjs.map +1 -0
  36. package/_cjs/String.cjs +6 -0
  37. package/_cjs/String.cjs.map +1 -0
  38. package/_cjs/Union.cjs +6 -0
  39. package/_cjs/Union.cjs.map +1 -0
  40. package/_cjs/index.cjs +51 -0
  41. package/_cjs/index.cjs.map +1 -0
  42. package/_mjs/Any.mjs +2 -0
  43. package/_mjs/Any.mjs.map +1 -0
  44. package/_mjs/Boolean.mjs +2 -0
  45. package/_mjs/Boolean.mjs.map +1 -0
  46. package/_mjs/BuiltIn.mjs +2 -0
  47. package/_mjs/BuiltIn.mjs.map +1 -0
  48. package/_mjs/Check.mjs +2 -0
  49. package/_mjs/Check.mjs.map +1 -0
  50. package/_mjs/Function.mjs +2 -0
  51. package/_mjs/Function.mjs.map +1 -0
  52. package/_mjs/HKT.mjs +19 -0
  53. package/_mjs/HKT.mjs.map +1 -0
  54. package/_mjs/Intersection.mjs +2 -0
  55. package/_mjs/Intersection.mjs.map +1 -0
  56. package/_mjs/Iteration.mjs +2 -0
  57. package/_mjs/Iteration.mjs.map +1 -0
  58. package/_mjs/List.mjs +2 -0
  59. package/_mjs/List.mjs.map +1 -0
  60. package/_mjs/Number.mjs +2 -0
  61. package/_mjs/Number.mjs.map +1 -0
  62. package/_mjs/Object.mjs +2 -0
  63. package/_mjs/Object.mjs.map +1 -0
  64. package/_mjs/String.mjs +2 -0
  65. package/_mjs/String.mjs.map +1 -0
  66. package/_mjs/Union.mjs +2 -0
  67. package/_mjs/Union.mjs.map +1 -0
  68. package/_mjs/index.mjs +21 -0
  69. package/_mjs/index.mjs.map +1 -0
  70. package/_src/Any.ts +100 -0
  71. package/_src/Boolean.ts +44 -0
  72. package/_src/BuiltIn.ts +7 -0
  73. package/_src/Check.ts +89 -0
  74. package/_src/Function.ts +24 -0
  75. package/_src/HKT.ts +349 -0
  76. package/_src/Intersection.ts +1 -0
  77. package/_src/Iteration.ts +224 -0
  78. package/_src/List.ts +47 -0
  79. package/_src/Number.ts +137 -0
  80. package/_src/Object.ts +332 -0
  81. package/_src/String.ts +28 -0
  82. package/_src/Union.ts +47 -0
  83. package/_src/index.ts +11 -0
  84. package/index.d.ts +11 -0
  85. package/package.json +13 -0
@@ -0,0 +1,224 @@
1
+ export type Iteration = [
2
+ value: number,
3
+ sign: "-" | "0" | "+",
4
+ prev: keyof IterationMap,
5
+ next: keyof IterationMap,
6
+ oppo: keyof IterationMap,
7
+ ];
8
+
9
+ export type IterationMap = {
10
+ __: [number, "-" | "0" | "+", "__", "__", "__"];
11
+ "-100": [-100, "-", "__", "-99", "100"];
12
+ "-99": [-99, "-", "-100", "-98", "99"];
13
+ "-98": [-98, "-", "-99", "-97", "98"];
14
+ "-97": [-97, "-", "-98", "-96", "97"];
15
+ "-96": [-96, "-", "-97", "-95", "96"];
16
+ "-95": [-95, "-", "-96", "-94", "95"];
17
+ "-94": [-94, "-", "-95", "-93", "94"];
18
+ "-93": [-93, "-", "-94", "-92", "93"];
19
+ "-92": [-92, "-", "-93", "-91", "92"];
20
+ "-91": [-91, "-", "-92", "-90", "91"];
21
+ "-90": [-90, "-", "-91", "-89", "90"];
22
+ "-89": [-89, "-", "-90", "-88", "89"];
23
+ "-88": [-88, "-", "-89", "-87", "88"];
24
+ "-87": [-87, "-", "-88", "-86", "87"];
25
+ "-86": [-86, "-", "-87", "-85", "86"];
26
+ "-85": [-85, "-", "-86", "-84", "85"];
27
+ "-84": [-84, "-", "-85", "-83", "84"];
28
+ "-83": [-83, "-", "-84", "-82", "83"];
29
+ "-82": [-82, "-", "-83", "-81", "82"];
30
+ "-81": [-81, "-", "-82", "-80", "81"];
31
+ "-80": [-80, "-", "-81", "-79", "80"];
32
+ "-79": [-79, "-", "-80", "-78", "79"];
33
+ "-78": [-78, "-", "-79", "-77", "78"];
34
+ "-77": [-77, "-", "-78", "-76", "77"];
35
+ "-76": [-76, "-", "-77", "-75", "76"];
36
+ "-75": [-75, "-", "-76", "-74", "75"];
37
+ "-74": [-74, "-", "-75", "-73", "74"];
38
+ "-73": [-73, "-", "-74", "-72", "73"];
39
+ "-72": [-72, "-", "-73", "-71", "72"];
40
+ "-71": [-71, "-", "-72", "-70", "71"];
41
+ "-70": [-70, "-", "-71", "-69", "70"];
42
+ "-69": [-69, "-", "-70", "-68", "69"];
43
+ "-68": [-68, "-", "-69", "-67", "68"];
44
+ "-67": [-67, "-", "-68", "-66", "67"];
45
+ "-66": [-66, "-", "-67", "-65", "66"];
46
+ "-65": [-65, "-", "-66", "-64", "65"];
47
+ "-64": [-64, "-", "-65", "-63", "64"];
48
+ "-63": [-63, "-", "-64", "-62", "63"];
49
+ "-62": [-62, "-", "-63", "-61", "62"];
50
+ "-61": [-61, "-", "-62", "-60", "61"];
51
+ "-60": [-60, "-", "-61", "-59", "60"];
52
+ "-59": [-59, "-", "-60", "-58", "59"];
53
+ "-58": [-58, "-", "-59", "-57", "58"];
54
+ "-57": [-57, "-", "-58", "-56", "57"];
55
+ "-56": [-56, "-", "-57", "-55", "56"];
56
+ "-55": [-55, "-", "-56", "-54", "55"];
57
+ "-54": [-54, "-", "-55", "-53", "54"];
58
+ "-53": [-53, "-", "-54", "-52", "53"];
59
+ "-52": [-52, "-", "-53", "-51", "52"];
60
+ "-51": [-51, "-", "-52", "-50", "51"];
61
+ "-50": [-50, "-", "-51", "-49", "50"];
62
+ "-49": [-49, "-", "-50", "-48", "49"];
63
+ "-48": [-48, "-", "-49", "-47", "48"];
64
+ "-47": [-47, "-", "-48", "-46", "47"];
65
+ "-46": [-46, "-", "-47", "-45", "46"];
66
+ "-45": [-45, "-", "-46", "-44", "45"];
67
+ "-44": [-44, "-", "-45", "-43", "44"];
68
+ "-43": [-43, "-", "-44", "-42", "43"];
69
+ "-42": [-42, "-", "-43", "-41", "42"];
70
+ "-41": [-41, "-", "-42", "-40", "41"];
71
+ "-40": [-40, "-", "-41", "-39", "40"];
72
+ "-39": [-39, "-", "-40", "-38", "39"];
73
+ "-38": [-38, "-", "-39", "-37", "38"];
74
+ "-37": [-37, "-", "-38", "-36", "37"];
75
+ "-36": [-36, "-", "-37", "-35", "36"];
76
+ "-35": [-35, "-", "-36", "-34", "35"];
77
+ "-34": [-34, "-", "-35", "-33", "34"];
78
+ "-33": [-33, "-", "-34", "-32", "33"];
79
+ "-32": [-32, "-", "-33", "-31", "32"];
80
+ "-31": [-31, "-", "-32", "-30", "31"];
81
+ "-30": [-30, "-", "-31", "-29", "30"];
82
+ "-29": [-29, "-", "-30", "-28", "29"];
83
+ "-28": [-28, "-", "-29", "-27", "28"];
84
+ "-27": [-27, "-", "-28", "-26", "27"];
85
+ "-26": [-26, "-", "-27", "-25", "26"];
86
+ "-25": [-25, "-", "-26", "-24", "25"];
87
+ "-24": [-24, "-", "-25", "-23", "24"];
88
+ "-23": [-23, "-", "-24", "-22", "23"];
89
+ "-22": [-22, "-", "-23", "-21", "22"];
90
+ "-21": [-21, "-", "-22", "-20", "21"];
91
+ "-20": [-20, "-", "-21", "-19", "20"];
92
+ "-19": [-19, "-", "-20", "-18", "19"];
93
+ "-18": [-18, "-", "-19", "-17", "18"];
94
+ "-17": [-17, "-", "-18", "-16", "17"];
95
+ "-16": [-16, "-", "-17", "-15", "16"];
96
+ "-15": [-15, "-", "-16", "-14", "15"];
97
+ "-14": [-14, "-", "-15", "-13", "14"];
98
+ "-13": [-13, "-", "-14", "-12", "13"];
99
+ "-12": [-12, "-", "-13", "-11", "12"];
100
+ "-11": [-11, "-", "-12", "-10", "11"];
101
+ "-10": [-10, "-", "-11", "-9", "10"];
102
+ "-9": [-9, "-", "-10", "-8", "9"];
103
+ "-8": [-8, "-", "-9", "-7", "8"];
104
+ "-7": [-7, "-", "-8", "-6", "7"];
105
+ "-6": [-6, "-", "-7", "-5", "6"];
106
+ "-5": [-5, "-", "-6", "-4", "5"];
107
+ "-4": [-4, "-", "-5", "-3", "4"];
108
+ "-3": [-3, "-", "-4", "-2", "3"];
109
+ "-2": [-2, "-", "-3", "-1", "2"];
110
+ "-1": [-1, "-", "-2", "0", "1"];
111
+ "0": [0, "0", "-1", "1", "0"];
112
+ "1": [1, "+", "0", "2", "-1"];
113
+ "2": [2, "+", "1", "3", "-2"];
114
+ "3": [3, "+", "2", "4", "-3"];
115
+ "4": [4, "+", "3", "5", "-4"];
116
+ "5": [5, "+", "4", "6", "-5"];
117
+ "6": [6, "+", "5", "7", "-6"];
118
+ "7": [7, "+", "6", "8", "-7"];
119
+ "8": [8, "+", "7", "9", "-8"];
120
+ "9": [9, "+", "8", "10", "-9"];
121
+ "10": [10, "+", "9", "11", "-10"];
122
+ "11": [11, "+", "10", "12", "-11"];
123
+ "12": [12, "+", "11", "13", "-12"];
124
+ "13": [13, "+", "12", "14", "-13"];
125
+ "14": [14, "+", "13", "15", "-14"];
126
+ "15": [15, "+", "14", "16", "-15"];
127
+ "16": [16, "+", "15", "17", "-16"];
128
+ "17": [17, "+", "16", "18", "-17"];
129
+ "18": [18, "+", "17", "19", "-18"];
130
+ "19": [19, "+", "18", "20", "-19"];
131
+ "20": [20, "+", "19", "21", "-20"];
132
+ "21": [21, "+", "20", "22", "-21"];
133
+ "22": [22, "+", "21", "23", "-22"];
134
+ "23": [23, "+", "22", "24", "-23"];
135
+ "24": [24, "+", "23", "25", "-24"];
136
+ "25": [25, "+", "24", "26", "-25"];
137
+ "26": [26, "+", "25", "27", "-26"];
138
+ "27": [27, "+", "26", "28", "-27"];
139
+ "28": [28, "+", "27", "29", "-28"];
140
+ "29": [29, "+", "28", "30", "-29"];
141
+ "30": [30, "+", "29", "31", "-30"];
142
+ "31": [31, "+", "30", "32", "-31"];
143
+ "32": [32, "+", "31", "33", "-32"];
144
+ "33": [33, "+", "32", "34", "-33"];
145
+ "34": [34, "+", "33", "35", "-34"];
146
+ "35": [35, "+", "34", "36", "-35"];
147
+ "36": [36, "+", "35", "37", "-36"];
148
+ "37": [37, "+", "36", "38", "-37"];
149
+ "38": [38, "+", "37", "39", "-38"];
150
+ "39": [39, "+", "38", "40", "-39"];
151
+ "40": [40, "+", "39", "41", "-40"];
152
+ "41": [41, "+", "40", "42", "-41"];
153
+ "42": [42, "+", "41", "43", "-42"];
154
+ "43": [43, "+", "42", "44", "-43"];
155
+ "44": [44, "+", "43", "45", "-44"];
156
+ "45": [45, "+", "44", "46", "-45"];
157
+ "46": [46, "+", "45", "47", "-46"];
158
+ "47": [47, "+", "46", "48", "-47"];
159
+ "48": [48, "+", "47", "49", "-48"];
160
+ "49": [49, "+", "48", "50", "-49"];
161
+ "50": [50, "+", "49", "51", "-50"];
162
+ "51": [51, "+", "50", "52", "-51"];
163
+ "52": [52, "+", "51", "53", "-52"];
164
+ "53": [53, "+", "52", "54", "-53"];
165
+ "54": [54, "+", "53", "55", "-54"];
166
+ "55": [55, "+", "54", "56", "-55"];
167
+ "56": [56, "+", "55", "57", "-56"];
168
+ "57": [57, "+", "56", "58", "-57"];
169
+ "58": [58, "+", "57", "59", "-58"];
170
+ "59": [59, "+", "58", "60", "-59"];
171
+ "60": [60, "+", "59", "61", "-60"];
172
+ "61": [61, "+", "60", "62", "-61"];
173
+ "62": [62, "+", "61", "63", "-62"];
174
+ "63": [63, "+", "62", "64", "-63"];
175
+ "64": [64, "+", "63", "65", "-64"];
176
+ "65": [65, "+", "64", "66", "-65"];
177
+ "66": [66, "+", "65", "67", "-66"];
178
+ "67": [67, "+", "66", "68", "-67"];
179
+ "68": [68, "+", "67", "69", "-68"];
180
+ "69": [69, "+", "68", "70", "-69"];
181
+ "70": [70, "+", "69", "71", "-70"];
182
+ "71": [71, "+", "70", "72", "-71"];
183
+ "72": [72, "+", "71", "73", "-72"];
184
+ "73": [73, "+", "72", "74", "-73"];
185
+ "74": [74, "+", "73", "75", "-74"];
186
+ "75": [75, "+", "74", "76", "-75"];
187
+ "76": [76, "+", "75", "77", "-76"];
188
+ "77": [77, "+", "76", "78", "-77"];
189
+ "78": [78, "+", "77", "79", "-78"];
190
+ "79": [79, "+", "78", "80", "-79"];
191
+ "80": [80, "+", "79", "81", "-80"];
192
+ "81": [81, "+", "80", "82", "-81"];
193
+ "82": [82, "+", "81", "83", "-82"];
194
+ "83": [83, "+", "82", "84", "-83"];
195
+ "84": [84, "+", "83", "85", "-84"];
196
+ "85": [85, "+", "84", "86", "-85"];
197
+ "86": [86, "+", "85", "87", "-86"];
198
+ "87": [87, "+", "86", "88", "-87"];
199
+ "88": [88, "+", "87", "89", "-88"];
200
+ "89": [89, "+", "88", "90", "-89"];
201
+ "90": [90, "+", "89", "91", "-90"];
202
+ "91": [91, "+", "90", "92", "-91"];
203
+ "92": [92, "+", "91", "93", "-92"];
204
+ "93": [93, "+", "92", "94", "-93"];
205
+ "94": [94, "+", "93", "95", "-94"];
206
+ "95": [95, "+", "94", "96", "-95"];
207
+ "96": [96, "+", "95", "97", "-96"];
208
+ "97": [97, "+", "96", "98", "-97"];
209
+ "98": [98, "+", "97", "99", "-98"];
210
+ "99": [99, "+", "98", "100", "-99"];
211
+ "100": [100, "+", "99", "__", "-100"];
212
+ };
213
+
214
+ export type IterationOf<N extends number> = `${N}` extends keyof IterationMap
215
+ ? IterationMap[`${N}`]
216
+ : IterationMap["__"];
217
+
218
+ export type Next<I extends Iteration> = IterationMap[I[3]];
219
+
220
+ export type Prev<I extends Iteration> = IterationMap[I[2]];
221
+
222
+ export type Pos<I extends Iteration> = I[0];
223
+
224
+ export type Key<I extends Iteration> = `${Pos<I>}`;
package/_src/List.ts ADDED
@@ -0,0 +1,47 @@
1
+ import type * as O from "./Object.js";
2
+
3
+ export type List<A = any> = ReadonlyArray<A>;
4
+
5
+ export type Prepend<L extends List, A> = [A, ...L];
6
+
7
+ export type Append<L extends List, A> = [...L, A];
8
+
9
+ export type Concat<L1 extends List, L2 extends List> = [...L1, ...L2];
10
+
11
+ export type Length<L extends List> = L["length"];
12
+
13
+ export type Head<L extends List> = L[0];
14
+
15
+ export type Tail<L extends List> = L extends readonly []
16
+ ? L
17
+ : L extends readonly [any?, ...infer Tail]
18
+ ? Tail
19
+ : L;
20
+
21
+ export type Init<L extends List> = L extends readonly []
22
+ ? L
23
+ : L extends readonly [...infer Init, any?]
24
+ ? Init
25
+ : L;
26
+
27
+ export type Last<L extends List> = L[Length<Tail<L>>];
28
+
29
+ export type UnionOf<L extends List> = L[number];
30
+
31
+ export type PrependAll<L extends List, A, O extends List = []> = Length<L> extends 0
32
+ ? O
33
+ : PrependAll<Tail<L>, A, [...O, A, Head<L>]>;
34
+
35
+ export type Pop<L extends List> = L extends
36
+ | readonly [...infer LBody, any]
37
+ | readonly [...infer LBody, any?]
38
+ ? LBody
39
+ : L;
40
+
41
+ export type ObjectOf<L extends List> = L extends unknown
42
+ ? number extends Length<L>
43
+ ? O._Pick<L, number>
44
+ : O._Omit<L, keyof any[]>
45
+ : never;
46
+
47
+ export type RequiredKeys<L extends List> = O.RequiredKeys<ObjectOf<L>>;
package/_src/Number.ts ADDED
@@ -0,0 +1,137 @@
1
+ import type { Cast, Equals } from "./Any.js";
2
+ import type { False, Or, True } from "./Boolean.js";
3
+ import type { Iteration, IterationMap, IterationOf, Next, Pos, Prev } from "./Iteration.js";
4
+
5
+ export type _IsNegative<N extends Iteration> = {
6
+ "-": True;
7
+ "+": False;
8
+ "0": False;
9
+ }[N[1]];
10
+
11
+ export type IsNegative<N extends number> = _IsNegative<IterationOf<N>>;
12
+
13
+ export type _IsPositive<N extends Iteration> = {
14
+ "-": False;
15
+ "+": True;
16
+ "0": False;
17
+ }[N[1]];
18
+
19
+ export type IsPositive<N extends number> = _IsPositive<IterationOf<N>>;
20
+
21
+ export type _IsZero<N extends Iteration> = {
22
+ "-": False;
23
+ "+": False;
24
+ "0": True;
25
+ }[N[1]];
26
+
27
+ export type IsZero<N extends number> = _IsZero<IterationOf<N>>;
28
+
29
+ export type _Negate<N extends Iteration> = IterationMap[N[4]];
30
+
31
+ export type Negate<N extends number> = N extends unknown ? _Negate<IterationOf<N>>[0] : never;
32
+
33
+ export type _AddPositive<N1 extends Iteration, N2 extends Iteration> = Pos<N2> extends 0
34
+ ? N1
35
+ : number extends Pos<N2>
36
+ ? IterationOf<number>
37
+ : _AddPositive<Next<N1>, Prev<N2>>;
38
+
39
+ export type AddPositive<N1 extends Iteration, N2 extends Iteration> = _AddPositive<
40
+ N1,
41
+ N2
42
+ > extends infer X
43
+ ? Cast<X, Iteration>
44
+ : never;
45
+
46
+ export type _AddNegative<N1 extends Iteration, N2 extends Iteration> = Pos<N2> extends 0
47
+ ? N1
48
+ : number extends Pos<N2>
49
+ ? IterationOf<number>
50
+ : _AddNegative<Prev<N1>, Next<N2>>;
51
+
52
+ export type AddNegative<N1 extends Iteration, N2 extends Iteration> = _AddNegative<
53
+ N1,
54
+ N2
55
+ > extends infer X
56
+ ? Cast<X, Iteration>
57
+ : never;
58
+
59
+ export type _Add<N1 extends Iteration, N2 extends Iteration> = {
60
+ [False]: AddPositive<N1, N2>;
61
+ [True]: AddNegative<N1, N2>;
62
+ }[_IsNegative<N2>];
63
+
64
+ export type Add<N1 extends number, N2 extends number> = N1 extends unknown
65
+ ? N2 extends unknown
66
+ ? _Add<IterationOf<N1>, IterationOf<N2>>[0]
67
+ : never
68
+ : never;
69
+
70
+ export type _Sub<N1 extends Iteration, N2 extends Iteration> = _Add<N1, _Negate<N2>>;
71
+
72
+ export type Sub<N1 extends number, N2 extends number> = N1 extends unknown
73
+ ? N2 extends unknown
74
+ ? _Add<IterationOf<N1>, _Negate<IterationOf<N2>>>[0]
75
+ : never
76
+ : never;
77
+
78
+ export type _Absolute<N extends Iteration> = {
79
+ [False]: N;
80
+ [True]: _Negate<N>;
81
+ }[_IsNegative<N>];
82
+
83
+ export type Absolute<N extends number> = N extends unknown ? _Absolute<IterationOf<N>> : never;
84
+
85
+ export type _Greater<N1 extends Iteration, N2 extends Iteration> = _IsPositive<_Sub<N1, N2>>;
86
+
87
+ export type Greater<X extends number, Y extends number> = X extends unknown
88
+ ? Y extends unknown
89
+ ? _Greater<IterationOf<X>, IterationOf<Y>>
90
+ : never
91
+ : never;
92
+
93
+ export type _Lower<N1 extends Iteration, N2 extends Iteration> = _Greater<N2, N1>;
94
+
95
+ export type Lower<X extends number, Y extends number> = X extends unknown
96
+ ? Y extends unknown
97
+ ? _Lower<IterationOf<X>, IterationOf<Y>>
98
+ : never
99
+ : never;
100
+
101
+ export type _GreaterEq<N1 extends Iteration, N2 extends Iteration> = Or<
102
+ Equals<N1, N2>,
103
+ _Greater<N1, N2>
104
+ >;
105
+
106
+ export type GreaterEq<X extends number, Y extends number> = X extends unknown
107
+ ? Y extends unknown
108
+ ? _GreaterEq<IterationOf<X>, IterationOf<Y>>
109
+ : never
110
+ : never;
111
+
112
+ export type _LowerEq<N1 extends Iteration, N2 extends Iteration> = Or<
113
+ Equals<N1, N2>,
114
+ _Lower<N1, N2>
115
+ >;
116
+
117
+ export type LowerEq<X extends number, Y extends number> = X extends unknown
118
+ ? Y extends unknown
119
+ ? _LowerEq<IterationOf<X>, IterationOf<Y>>
120
+ : never
121
+ : never;
122
+
123
+ export type Comparison = "<" | ">" | "<=" | ">=" | "==";
124
+
125
+ export type _Comp<N1 extends Iteration, C extends Comparison, N2 extends Iteration> = {
126
+ "<": _Lower<N1, N2>;
127
+ ">": _Greater<N1, N2>;
128
+ "<=": _LowerEq<N1, N2>;
129
+ ">=": _GreaterEq<N1, N2>;
130
+ "==": Equals<N1, N2>;
131
+ }[C];
132
+
133
+ export type Comp<X extends number, C extends Comparison, Y extends number> = X extends unknown
134
+ ? Y extends unknown
135
+ ? _Comp<IterationOf<X>, C, IterationOf<Y>>
136
+ : never
137
+ : never;