complete-common 1.0.0 → 1.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.
- package/LICENSE +1 -1
- package/README.md +3 -3
- package/dist/constants.d.cts +7 -0
- package/dist/constants.d.mts +7 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/functions/array.d.cts +83 -0
- package/dist/functions/array.d.mts +83 -0
- package/dist/functions/array.d.ts +83 -0
- package/dist/functions/array.d.ts.map +1 -0
- package/dist/functions/assert.d.cts +22 -0
- package/dist/functions/assert.d.mts +22 -0
- package/dist/functions/assert.d.ts +22 -0
- package/dist/functions/assert.d.ts.map +1 -0
- package/dist/functions/enums.d.cts +73 -0
- package/dist/functions/enums.d.mts +73 -0
- package/dist/functions/enums.d.ts +73 -0
- package/dist/functions/enums.d.ts.map +1 -0
- package/dist/functions/map.d.cts +52 -0
- package/dist/functions/map.d.mts +52 -0
- package/dist/functions/map.d.ts +52 -0
- package/dist/functions/map.d.ts.map +1 -0
- package/dist/functions/math.d.cts +13 -0
- package/dist/functions/math.d.mts +13 -0
- package/dist/functions/math.d.ts +13 -0
- package/dist/functions/math.d.ts.map +1 -0
- package/dist/functions/object.d.cts +14 -0
- package/dist/functions/object.d.mts +14 -0
- package/dist/functions/object.d.ts +14 -0
- package/dist/functions/object.d.ts.map +1 -0
- package/dist/functions/random.d.cts +23 -0
- package/dist/functions/random.d.mts +23 -0
- package/dist/functions/random.d.ts +23 -0
- package/dist/functions/random.d.ts.map +1 -0
- package/dist/functions/set.d.cts +61 -0
- package/dist/functions/set.d.mts +61 -0
- package/dist/functions/set.d.ts +61 -0
- package/dist/functions/set.d.ts.map +1 -0
- package/dist/functions/sort.d.cts +14 -0
- package/dist/functions/sort.d.mts +14 -0
- package/dist/functions/sort.d.ts +14 -0
- package/dist/functions/sort.d.ts.map +1 -0
- package/dist/functions/string.d.cts +122 -0
- package/dist/functions/string.d.mts +122 -0
- package/dist/functions/string.d.ts +122 -0
- package/dist/functions/string.d.ts.map +1 -0
- package/dist/functions/string.test.d.cts +2 -0
- package/dist/functions/string.test.d.mts +2 -0
- package/dist/functions/string.test.d.ts +2 -0
- package/dist/functions/string.test.d.ts.map +1 -0
- package/dist/functions/tuple.d.cts +27 -0
- package/dist/functions/tuple.d.mts +27 -0
- package/dist/functions/tuple.d.ts +27 -0
- package/dist/functions/tuple.d.ts.map +1 -0
- package/dist/functions/types.d.cts +13 -0
- package/dist/functions/types.d.mts +13 -0
- package/dist/functions/types.d.ts +13 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/functions/utils.d.cts +131 -0
- package/dist/functions/utils.d.mts +131 -0
- package/dist/functions/utils.d.ts +131 -0
- package/dist/functions/utils.d.ts.map +1 -0
- package/dist/functions/utils.test.d.cts +2 -0
- package/dist/functions/utils.test.d.mts +2 -0
- package/dist/functions/utils.test.d.ts +2 -0
- package/dist/functions/utils.test.d.ts.map +1 -0
- package/dist/index.cjs +66 -65
- package/dist/index.d.cts +29 -705
- package/dist/index.d.mts +29 -705
- package/dist/index.d.ts +29 -705
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +66 -65
- package/dist/types/AddSubtract.d.cts +23 -0
- package/dist/types/AddSubtract.d.mts +23 -0
- package/dist/types/AddSubtract.d.ts +23 -0
- package/dist/types/AddSubtract.d.ts.map +1 -0
- package/dist/types/CompositionTypeSatisfiesEnum.d.cts +35 -0
- package/dist/types/CompositionTypeSatisfiesEnum.d.mts +35 -0
- package/dist/types/CompositionTypeSatisfiesEnum.d.ts +35 -0
- package/dist/types/CompositionTypeSatisfiesEnum.d.ts.map +1 -0
- package/dist/types/ERange.d.cts +12 -0
- package/dist/types/ERange.d.mts +12 -0
- package/dist/types/ERange.d.ts +12 -0
- package/dist/types/ERange.d.ts.map +1 -0
- package/dist/types/IRange.d.cts +13 -0
- package/dist/types/IRange.d.mts +13 -0
- package/dist/types/IRange.d.ts +13 -0
- package/dist/types/IRange.d.ts.map +1 -0
- package/dist/types/Immutable.d.cts +17 -0
- package/dist/types/Immutable.d.mts +17 -0
- package/dist/types/Immutable.d.ts +17 -0
- package/dist/types/Immutable.d.ts.map +1 -0
- package/dist/types/NaturalNumbersLessThan.d.cts +8 -0
- package/dist/types/NaturalNumbersLessThan.d.mts +8 -0
- package/dist/types/NaturalNumbersLessThan.d.ts +8 -0
- package/dist/types/NaturalNumbersLessThan.d.ts.map +1 -0
- package/dist/types/NaturalNumbersLessThanOrEqualTo.d.cts +8 -0
- package/dist/types/NaturalNumbersLessThanOrEqualTo.d.mts +8 -0
- package/dist/types/NaturalNumbersLessThanOrEqualTo.d.ts +8 -0
- package/dist/types/NaturalNumbersLessThanOrEqualTo.d.ts.map +1 -0
- package/dist/types/ObjectValues.d.cts +3 -0
- package/dist/types/ObjectValues.d.mts +3 -0
- package/dist/types/ObjectValues.d.ts +3 -0
- package/dist/types/ObjectValues.d.ts.map +1 -0
- package/dist/types/ReadonlyMap.d.cts +9 -0
- package/dist/types/ReadonlyMap.d.mts +9 -0
- package/dist/types/ReadonlyMap.d.ts +9 -0
- package/dist/types/ReadonlyMap.d.ts.map +1 -0
- package/dist/types/ReadonlyRecord.d.cts +7 -0
- package/dist/types/ReadonlyRecord.d.mts +7 -0
- package/dist/types/ReadonlyRecord.d.ts +7 -0
- package/dist/types/ReadonlyRecord.d.ts.map +1 -0
- package/dist/types/ReadonlySet.d.cts +8 -0
- package/dist/types/ReadonlySet.d.mts +8 -0
- package/dist/types/ReadonlySet.d.ts +8 -0
- package/dist/types/ReadonlySet.d.ts.map +1 -0
- package/dist/types/Tuple.d.cts +10 -0
- package/dist/types/Tuple.d.mts +10 -0
- package/dist/types/Tuple.d.ts +10 -0
- package/dist/types/Tuple.d.ts.map +1 -0
- package/dist/types/WidenLiteral.d.cts +3 -0
- package/dist/types/WidenLiteral.d.mts +3 -0
- package/dist/types/WidenLiteral.d.ts +3 -0
- package/dist/types/WidenLiteral.d.ts.map +1 -0
- package/dist/types/Writeable.d.cts +9 -0
- package/dist/types/Writeable.d.mts +9 -0
- package/dist/types/Writeable.d.ts +9 -0
- package/dist/types/Writeable.d.ts.map +1 -0
- package/package.json +12 -2
- package/src/constants.ts +5 -0
- package/src/functions/array.ts +8 -2
- package/src/functions/assert.ts +41 -0
- package/src/functions/enums.ts +6 -0
- package/src/functions/map.ts +7 -0
- package/src/functions/math.ts +6 -0
- package/src/functions/object.ts +8 -3
- package/src/functions/random.ts +6 -0
- package/src/functions/set.ts +7 -0
- package/src/functions/sort.ts +6 -0
- package/src/functions/string.ts +25 -0
- package/src/functions/tuple.ts +6 -0
- package/src/functions/types.ts +6 -0
- package/src/functions/utils.test.ts +2 -8
- package/src/functions/utils.ts +7 -37
- package/src/index.ts +13 -12
- package/src/types/AddSubtract.ts +10 -2
- package/src/types/CompositionTypeSatisfiesEnum.ts +5 -3
- package/src/types/ObjectValues.ts +1 -0
- package/src/types/ReadonlyRecord.ts +5 -0
- package/src/types/Tuple.ts +1 -0
- package/src/types/WidenLiteral.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,yCAAyC,CAAC;AAC7D,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mCAAmC,CAAC;AACvD,mBAAmB,4CAA4C,CAAC;AAChE,mBAAmB,yBAAyB,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,mBAAmB,2BAA2B,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,sBAAsB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,17 @@ const HOUR_IN_MILLISECONDS = 60 * MINUTE_IN_MILLISECONDS;
|
|
|
4
4
|
|
|
5
5
|
const ReadonlySet = Set;
|
|
6
6
|
|
|
7
|
+
function assertDefined(value, ...[msg]) {
|
|
8
|
+
if (value === void 0) {
|
|
9
|
+
throw new TypeError(msg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function assertNotNull(value, ...[msg]) {
|
|
13
|
+
if (value === null) {
|
|
14
|
+
throw new TypeError(msg);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
7
18
|
function getRandomInt(min, max, exceptions = []) {
|
|
8
19
|
min = Math.ceil(min);
|
|
9
20
|
max = Math.floor(max);
|
|
@@ -21,70 +32,6 @@ function getRandomInt(min, max, exceptions = []) {
|
|
|
21
32
|
return randomInt;
|
|
22
33
|
}
|
|
23
34
|
|
|
24
|
-
const FLOAT_REGEX = /^-?\d*\.?\d+$/;
|
|
25
|
-
const INTEGER_REGEX = /^-?\d+$/;
|
|
26
|
-
function assertDefined(value, ...[msg]) {
|
|
27
|
-
if (value === void 0) {
|
|
28
|
-
throw new TypeError(msg);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function assertNotNull(value, ...[msg]) {
|
|
32
|
-
if (value === null) {
|
|
33
|
-
throw new TypeError(msg);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function* eRange(start, end, increment = 1) {
|
|
37
|
-
if (end === void 0) {
|
|
38
|
-
yield* eRange(0, start, increment);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
for (let i = start; i < end; i += increment) {
|
|
42
|
-
yield i;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function* iRange(start, end, increment = 1) {
|
|
46
|
-
if (end === void 0) {
|
|
47
|
-
yield* iRange(0, start, increment);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const exclusiveEnd = end + 1;
|
|
51
|
-
yield* eRange(start, exclusiveEnd, increment);
|
|
52
|
-
}
|
|
53
|
-
function isKeyOf(key, target) {
|
|
54
|
-
return key in target;
|
|
55
|
-
}
|
|
56
|
-
function noop() {
|
|
57
|
-
}
|
|
58
|
-
function parseFloatSafe(string) {
|
|
59
|
-
if (typeof string !== "string") {
|
|
60
|
-
return void 0;
|
|
61
|
-
}
|
|
62
|
-
const trimmedString = string.trim();
|
|
63
|
-
if (FLOAT_REGEX.exec(trimmedString) === null) {
|
|
64
|
-
return void 0;
|
|
65
|
-
}
|
|
66
|
-
const number = Number.parseFloat(trimmedString);
|
|
67
|
-
return Number.isNaN(number) ? void 0 : number;
|
|
68
|
-
}
|
|
69
|
-
function parseIntSafe(string) {
|
|
70
|
-
if (typeof string !== "string") {
|
|
71
|
-
return void 0;
|
|
72
|
-
}
|
|
73
|
-
const trimmedString = string.trim();
|
|
74
|
-
if (INTEGER_REGEX.exec(trimmedString) === null) {
|
|
75
|
-
return void 0;
|
|
76
|
-
}
|
|
77
|
-
const number = Number.parseInt(trimmedString, 10);
|
|
78
|
-
return Number.isNaN(number) ? void 0 : number;
|
|
79
|
-
}
|
|
80
|
-
function repeat(num, func) {
|
|
81
|
-
for (let i = 0; i < num; i++) {
|
|
82
|
-
func(i);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function todo(...args) {
|
|
86
|
-
}
|
|
87
|
-
|
|
88
35
|
function arrayCopyTwoDimensional(array) {
|
|
89
36
|
const copiedArray = [];
|
|
90
37
|
for (const subArray of array) {
|
|
@@ -115,7 +62,7 @@ function arrayRemoveInPlace(array, ...elementsToRemove) {
|
|
|
115
62
|
const removedElements = [];
|
|
116
63
|
for (const element of elementsToRemove) {
|
|
117
64
|
const index = array.indexOf(element);
|
|
118
|
-
if (index
|
|
65
|
+
if (index !== -1) {
|
|
119
66
|
const removedElement = array.splice(index, 1);
|
|
120
67
|
removedElements.push(...removedElement);
|
|
121
68
|
}
|
|
@@ -306,6 +253,60 @@ function sortCaseInsensitive(array) {
|
|
|
306
253
|
return newArray;
|
|
307
254
|
}
|
|
308
255
|
|
|
256
|
+
const FLOAT_REGEX = /^-?\d*\.?\d+$/;
|
|
257
|
+
const INTEGER_REGEX = /^-?\d+$/;
|
|
258
|
+
function* eRange(start, end, increment = 1) {
|
|
259
|
+
if (end === void 0) {
|
|
260
|
+
yield* eRange(0, start, increment);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
for (let i = start; i < end; i += increment) {
|
|
264
|
+
yield i;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function* iRange(start, end, increment = 1) {
|
|
268
|
+
if (end === void 0) {
|
|
269
|
+
yield* iRange(0, start, increment);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const exclusiveEnd = end + 1;
|
|
273
|
+
yield* eRange(start, exclusiveEnd, increment);
|
|
274
|
+
}
|
|
275
|
+
function isKeyOf(key, target) {
|
|
276
|
+
return key in target;
|
|
277
|
+
}
|
|
278
|
+
function noop() {
|
|
279
|
+
}
|
|
280
|
+
function parseFloatSafe(string) {
|
|
281
|
+
if (typeof string !== "string") {
|
|
282
|
+
return void 0;
|
|
283
|
+
}
|
|
284
|
+
const trimmedString = string.trim();
|
|
285
|
+
if (FLOAT_REGEX.exec(trimmedString) === null) {
|
|
286
|
+
return void 0;
|
|
287
|
+
}
|
|
288
|
+
const number = Number.parseFloat(trimmedString);
|
|
289
|
+
return Number.isNaN(number) ? void 0 : number;
|
|
290
|
+
}
|
|
291
|
+
function parseIntSafe(string) {
|
|
292
|
+
if (typeof string !== "string") {
|
|
293
|
+
return void 0;
|
|
294
|
+
}
|
|
295
|
+
const trimmedString = string.trim();
|
|
296
|
+
if (INTEGER_REGEX.exec(trimmedString) === null) {
|
|
297
|
+
return void 0;
|
|
298
|
+
}
|
|
299
|
+
const number = Number.parseInt(trimmedString, 10);
|
|
300
|
+
return Number.isNaN(number) ? void 0 : number;
|
|
301
|
+
}
|
|
302
|
+
function repeat(num, func) {
|
|
303
|
+
for (let i = 0; i < num; i++) {
|
|
304
|
+
func(i);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function todo(...args) {
|
|
308
|
+
}
|
|
309
|
+
|
|
309
310
|
const DIACRITIC_REGEX = /\p{Diacritic}/u;
|
|
310
311
|
const EMOJI_REGEX = /(\p{Extended_Pictographic}|\p{Emoji_Component})/u;
|
|
311
312
|
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/u;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to add two other types.
|
|
3
|
+
*
|
|
4
|
+
* From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468
|
|
5
|
+
*/
|
|
6
|
+
export type Add<A extends number, B extends number> = Length<[
|
|
7
|
+
...BuildTuple<A>,
|
|
8
|
+
...BuildTuple<B>
|
|
9
|
+
]>;
|
|
10
|
+
/**
|
|
11
|
+
* Helper type to subtract two other types.
|
|
12
|
+
*
|
|
13
|
+
* From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468
|
|
14
|
+
*/
|
|
15
|
+
export type Subtract<A extends number, B extends number> = A extends A ? BuildTuple<A> extends [...infer U, ...BuildTuple<B>] ? Length<U> : never : never;
|
|
16
|
+
type BuildTuple<L extends number, T extends unknown[] = []> = T extends {
|
|
17
|
+
length: L;
|
|
18
|
+
} ? T : BuildTuple<L, [...T, unknown]>;
|
|
19
|
+
type Length<T extends unknown[]> = T extends {
|
|
20
|
+
length: infer L;
|
|
21
|
+
} ? L : never;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=AddSubtract.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to add two other types.
|
|
3
|
+
*
|
|
4
|
+
* From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468
|
|
5
|
+
*/
|
|
6
|
+
export type Add<A extends number, B extends number> = Length<[
|
|
7
|
+
...BuildTuple<A>,
|
|
8
|
+
...BuildTuple<B>
|
|
9
|
+
]>;
|
|
10
|
+
/**
|
|
11
|
+
* Helper type to subtract two other types.
|
|
12
|
+
*
|
|
13
|
+
* From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468
|
|
14
|
+
*/
|
|
15
|
+
export type Subtract<A extends number, B extends number> = A extends A ? BuildTuple<A> extends [...infer U, ...BuildTuple<B>] ? Length<U> : never : never;
|
|
16
|
+
type BuildTuple<L extends number, T extends unknown[] = []> = T extends {
|
|
17
|
+
length: L;
|
|
18
|
+
} ? T : BuildTuple<L, [...T, unknown]>;
|
|
19
|
+
type Length<T extends unknown[]> = T extends {
|
|
20
|
+
length: infer L;
|
|
21
|
+
} ? L : never;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=AddSubtract.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to add two other types.
|
|
3
|
+
*
|
|
4
|
+
* From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468
|
|
5
|
+
*/
|
|
6
|
+
export type Add<A extends number, B extends number> = Length<[
|
|
7
|
+
...BuildTuple<A>,
|
|
8
|
+
...BuildTuple<B>
|
|
9
|
+
]>;
|
|
10
|
+
/**
|
|
11
|
+
* Helper type to subtract two other types.
|
|
12
|
+
*
|
|
13
|
+
* From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468
|
|
14
|
+
*/
|
|
15
|
+
export type Subtract<A extends number, B extends number> = A extends A ? BuildTuple<A> extends [...infer U, ...BuildTuple<B>] ? Length<U> : never : never;
|
|
16
|
+
type BuildTuple<L extends number, T extends unknown[] = []> = T extends {
|
|
17
|
+
length: L;
|
|
18
|
+
} ? T : BuildTuple<L, [...T, unknown]>;
|
|
19
|
+
type Length<T extends unknown[]> = T extends {
|
|
20
|
+
length: infer L;
|
|
21
|
+
} ? L : never;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=AddSubtract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddSubtract.d.ts","sourceRoot":"","sources":["../../src/types/AddSubtract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,MAAM,CAC1D;IAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAAE,GAAG,UAAU,CAAC,CAAC,CAAC;CAAC,CACrC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,GAClE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,GAClD,MAAM,CAAC,CAAC,CAAC,GACT,KAAK,GACP,KAAK,CAAC;AAEV,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS;IACtE,MAAM,EAAE,CAAC,CAAC;CACX,GACG,CAAC,GACD,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAEnC,KAAK,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to validate that a union of interfaces with a field of `type` that is based on an
|
|
3
|
+
* enum is complete.
|
|
4
|
+
*
|
|
5
|
+
* For example:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* enum ObjectiveType {
|
|
9
|
+
* Foo,
|
|
10
|
+
* Bar,
|
|
11
|
+
* Baz,
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* interface FooObjective {
|
|
15
|
+
* type: ObjectiveType.Foo;
|
|
16
|
+
* fooThing: number;
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* interface BarObjective {
|
|
20
|
+
* type: ObjectiveType.Bar;
|
|
21
|
+
* barThing: string;
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* type Objective = FooObjective | BarObjective;
|
|
25
|
+
* type _Test = CompositionTypeSatisfiesEnum<Objective, ObjectiveType>;
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* In this example, `Test` would be flagged by TypeScript because `Objective` does not contain an
|
|
29
|
+
* entry for `BazObjective`.
|
|
30
|
+
*/
|
|
31
|
+
export type CompositionTypeSatisfiesEnum<T extends {
|
|
32
|
+
/** The type of the discriminated union. */
|
|
33
|
+
type: unknown;
|
|
34
|
+
}, _Enum extends T["type"]> = unknown;
|
|
35
|
+
//# sourceMappingURL=CompositionTypeSatisfiesEnum.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to validate that a union of interfaces with a field of `type` that is based on an
|
|
3
|
+
* enum is complete.
|
|
4
|
+
*
|
|
5
|
+
* For example:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* enum ObjectiveType {
|
|
9
|
+
* Foo,
|
|
10
|
+
* Bar,
|
|
11
|
+
* Baz,
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* interface FooObjective {
|
|
15
|
+
* type: ObjectiveType.Foo;
|
|
16
|
+
* fooThing: number;
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* interface BarObjective {
|
|
20
|
+
* type: ObjectiveType.Bar;
|
|
21
|
+
* barThing: string;
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* type Objective = FooObjective | BarObjective;
|
|
25
|
+
* type _Test = CompositionTypeSatisfiesEnum<Objective, ObjectiveType>;
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* In this example, `Test` would be flagged by TypeScript because `Objective` does not contain an
|
|
29
|
+
* entry for `BazObjective`.
|
|
30
|
+
*/
|
|
31
|
+
export type CompositionTypeSatisfiesEnum<T extends {
|
|
32
|
+
/** The type of the discriminated union. */
|
|
33
|
+
type: unknown;
|
|
34
|
+
}, _Enum extends T["type"]> = unknown;
|
|
35
|
+
//# sourceMappingURL=CompositionTypeSatisfiesEnum.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to validate that a union of interfaces with a field of `type` that is based on an
|
|
3
|
+
* enum is complete.
|
|
4
|
+
*
|
|
5
|
+
* For example:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* enum ObjectiveType {
|
|
9
|
+
* Foo,
|
|
10
|
+
* Bar,
|
|
11
|
+
* Baz,
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* interface FooObjective {
|
|
15
|
+
* type: ObjectiveType.Foo;
|
|
16
|
+
* fooThing: number;
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* interface BarObjective {
|
|
20
|
+
* type: ObjectiveType.Bar;
|
|
21
|
+
* barThing: string;
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* type Objective = FooObjective | BarObjective;
|
|
25
|
+
* type _Test = CompositionTypeSatisfiesEnum<Objective, ObjectiveType>;
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* In this example, `Test` would be flagged by TypeScript because `Objective` does not contain an
|
|
29
|
+
* entry for `BazObjective`.
|
|
30
|
+
*/
|
|
31
|
+
export type CompositionTypeSatisfiesEnum<T extends {
|
|
32
|
+
/** The type of the discriminated union. */
|
|
33
|
+
type: unknown;
|
|
34
|
+
}, _Enum extends T["type"]> = unknown;
|
|
35
|
+
//# sourceMappingURL=CompositionTypeSatisfiesEnum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompositionTypeSatisfiesEnum.d.ts","sourceRoot":"","sources":["../../src/types/CompositionTypeSatisfiesEnum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,4BAA4B,CACtC,CAAC,SAAS;IACR,2CAA2C;IAC3C,IAAI,EAAE,OAAO,CAAC;CACf,EACD,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,IACrB,OAAO,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan.js";
|
|
2
|
+
/**
|
|
3
|
+
* Helper type to get a range of integers. It is inclusive on the lower end and exclusive on the
|
|
4
|
+
* high end. (The "E" in the type name stands for exclusive.)
|
|
5
|
+
*
|
|
6
|
+
* For example, `ERange<3, 5>` will return `3 | 4`.
|
|
7
|
+
*
|
|
8
|
+
* From:
|
|
9
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
10
|
+
*/
|
|
11
|
+
export type ERange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThan<High>, NaturalNumbersLessThan<Low>>;
|
|
12
|
+
//# sourceMappingURL=ERange.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan.js";
|
|
2
|
+
/**
|
|
3
|
+
* Helper type to get a range of integers. It is inclusive on the lower end and exclusive on the
|
|
4
|
+
* high end. (The "E" in the type name stands for exclusive.)
|
|
5
|
+
*
|
|
6
|
+
* For example, `ERange<3, 5>` will return `3 | 4`.
|
|
7
|
+
*
|
|
8
|
+
* From:
|
|
9
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
10
|
+
*/
|
|
11
|
+
export type ERange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThan<High>, NaturalNumbersLessThan<Low>>;
|
|
12
|
+
//# sourceMappingURL=ERange.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan.js";
|
|
2
|
+
/**
|
|
3
|
+
* Helper type to get a range of integers. It is inclusive on the lower end and exclusive on the
|
|
4
|
+
* high end. (The "E" in the type name stands for exclusive.)
|
|
5
|
+
*
|
|
6
|
+
* For example, `ERange<3, 5>` will return `3 | 4`.
|
|
7
|
+
*
|
|
8
|
+
* From:
|
|
9
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
10
|
+
*/
|
|
11
|
+
export type ERange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThan<High>, NaturalNumbersLessThan<Low>>;
|
|
12
|
+
//# sourceMappingURL=ERange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ERange.d.ts","sourceRoot":"","sources":["../../src/types/ERange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,CAAC,GAAG,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,OAAO,CACnE,sBAAsB,CAAC,IAAI,CAAC,EAC5B,sBAAsB,CAAC,GAAG,CAAC,CAC5B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan.js";
|
|
2
|
+
import type { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersLessThanOrEqualTo.js";
|
|
3
|
+
/**
|
|
4
|
+
* Helper type to get a range of integers. It is inclusive on both ends. (The "I" in the type name
|
|
5
|
+
* stands for inclusive.)
|
|
6
|
+
*
|
|
7
|
+
* For example, `IRange<3, 5>` will return `3 | 4 | 5`.
|
|
8
|
+
*
|
|
9
|
+
* From:
|
|
10
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
11
|
+
*/
|
|
12
|
+
export type IRange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
|
|
13
|
+
//# sourceMappingURL=IRange.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan.js";
|
|
2
|
+
import type { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersLessThanOrEqualTo.js";
|
|
3
|
+
/**
|
|
4
|
+
* Helper type to get a range of integers. It is inclusive on both ends. (The "I" in the type name
|
|
5
|
+
* stands for inclusive.)
|
|
6
|
+
*
|
|
7
|
+
* For example, `IRange<3, 5>` will return `3 | 4 | 5`.
|
|
8
|
+
*
|
|
9
|
+
* From:
|
|
10
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
11
|
+
*/
|
|
12
|
+
export type IRange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
|
|
13
|
+
//# sourceMappingURL=IRange.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan.js";
|
|
2
|
+
import type { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersLessThanOrEqualTo.js";
|
|
3
|
+
/**
|
|
4
|
+
* Helper type to get a range of integers. It is inclusive on both ends. (The "I" in the type name
|
|
5
|
+
* stands for inclusive.)
|
|
6
|
+
*
|
|
7
|
+
* For example, `IRange<3, 5>` will return `3 | 4 | 5`.
|
|
8
|
+
*
|
|
9
|
+
* From:
|
|
10
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
11
|
+
*/
|
|
12
|
+
export type IRange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
|
|
13
|
+
//# sourceMappingURL=IRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRange.d.ts","sourceRoot":"","sources":["../../src/types/IRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAE5F;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,CAAC,GAAG,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,OAAO,CACnE,+BAA+B,CAAC,IAAI,CAAC,EACrC,sBAAsB,CAAC,GAAG,CAAC,CAC5B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable is a utility type that will make the given array/map/set/object recursively read-only.
|
|
3
|
+
*
|
|
4
|
+
* You can use this type to easily build safe data structures.
|
|
5
|
+
*
|
|
6
|
+
* From: https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
|
|
7
|
+
*/
|
|
8
|
+
export type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
|
|
9
|
+
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
10
|
+
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
11
|
+
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
12
|
+
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
13
|
+
type ImmutableObject<T> = {
|
|
14
|
+
readonly [K in keyof T]: Immutable<T[K]>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=Immutable.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable is a utility type that will make the given array/map/set/object recursively read-only.
|
|
3
|
+
*
|
|
4
|
+
* You can use this type to easily build safe data structures.
|
|
5
|
+
*
|
|
6
|
+
* From: https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
|
|
7
|
+
*/
|
|
8
|
+
export type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
|
|
9
|
+
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
10
|
+
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
11
|
+
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
12
|
+
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
13
|
+
type ImmutableObject<T> = {
|
|
14
|
+
readonly [K in keyof T]: Immutable<T[K]>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=Immutable.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable is a utility type that will make the given array/map/set/object recursively read-only.
|
|
3
|
+
*
|
|
4
|
+
* You can use this type to easily build safe data structures.
|
|
5
|
+
*
|
|
6
|
+
* From: https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
|
|
7
|
+
*/
|
|
8
|
+
export type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
|
|
9
|
+
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
10
|
+
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
11
|
+
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
12
|
+
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
13
|
+
type ImmutableObject<T> = {
|
|
14
|
+
readonly [K in keyof T]: Immutable<T[K]>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=Immutable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Immutable.d.ts","sourceRoot":"","sources":["../../src/types/Immutable.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,kBAAkB,GACnD,CAAC,GACD,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACtB,cAAc,CAAC,CAAC,CAAC,GACjB,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC7B,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAClB,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GACpB,YAAY,CAAC,CAAC,CAAC,GACf,eAAe,CAAC,CAAC,CAAC,CAAC;AAE7B,KAAK,kBAAkB,GACnB,SAAS,GACT,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,CAAC;AACb,KAAK,cAAc,CAAC,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,KAAK,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,KAAK,eAAe,CAAC,CAAC,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to get a range of integers between 0 and N - 1.
|
|
3
|
+
*
|
|
4
|
+
* From:
|
|
5
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
6
|
+
*/
|
|
7
|
+
export type NaturalNumbersLessThan<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : NaturalNumbersLessThan<N, [...Acc, Acc["length"]]>;
|
|
8
|
+
//# sourceMappingURL=NaturalNumbersLessThan.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to get a range of integers between 0 and N - 1.
|
|
3
|
+
*
|
|
4
|
+
* From:
|
|
5
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
6
|
+
*/
|
|
7
|
+
export type NaturalNumbersLessThan<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : NaturalNumbersLessThan<N, [...Acc, Acc["length"]]>;
|
|
8
|
+
//# sourceMappingURL=NaturalNumbersLessThan.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to get a range of integers between 0 and N - 1.
|
|
3
|
+
*
|
|
4
|
+
* From:
|
|
5
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
6
|
+
*/
|
|
7
|
+
export type NaturalNumbersLessThan<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : NaturalNumbersLessThan<N, [...Acc, Acc["length"]]>;
|
|
8
|
+
//# sourceMappingURL=NaturalNumbersLessThan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NaturalNumbersLessThan.d.ts","sourceRoot":"","sources":["../../src/types/NaturalNumbersLessThan.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,CAChC,CAAC,SAAS,MAAM,EAChB,GAAG,SAAS,MAAM,EAAE,GAAG,EAAE,IACvB,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,GACvB,GAAG,CAAC,MAAM,CAAC,GACX,sBAAsB,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to get a range of integers between 0 and N.
|
|
3
|
+
*
|
|
4
|
+
* From:
|
|
5
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
6
|
+
*/
|
|
7
|
+
export type NaturalNumbersLessThanOrEqualTo<N extends number, T extends number[] = []> = T extends [unknown, ...infer Tail] ? Tail["length"] extends N ? T[number] : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]> : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]>;
|
|
8
|
+
//# sourceMappingURL=NaturalNumbersLessThanOrEqualTo.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to get a range of integers between 0 and N.
|
|
3
|
+
*
|
|
4
|
+
* From:
|
|
5
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
6
|
+
*/
|
|
7
|
+
export type NaturalNumbersLessThanOrEqualTo<N extends number, T extends number[] = []> = T extends [unknown, ...infer Tail] ? Tail["length"] extends N ? T[number] : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]> : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]>;
|
|
8
|
+
//# sourceMappingURL=NaturalNumbersLessThanOrEqualTo.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to get a range of integers between 0 and N.
|
|
3
|
+
*
|
|
4
|
+
* From:
|
|
5
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
6
|
+
*/
|
|
7
|
+
export type NaturalNumbersLessThanOrEqualTo<N extends number, T extends number[] = []> = T extends [unknown, ...infer Tail] ? Tail["length"] extends N ? T[number] : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]> : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]>;
|
|
8
|
+
//# sourceMappingURL=NaturalNumbersLessThanOrEqualTo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NaturalNumbersLessThanOrEqualTo.d.ts","sourceRoot":"","sources":["../../src/types/NaturalNumbersLessThanOrEqualTo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,+BAA+B,CACzC,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,IACrB,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,GAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GACtB,CAAC,CAAC,MAAM,CAAC,GACT,+BAA+B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GACzD,+BAA+B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectValues.d.ts","sourceRoot":"","sources":["../../src/types/ObjectValues.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ReadonlyMapConstructor {
|
|
2
|
+
new (): ReadonlyMap<any, any>;
|
|
3
|
+
new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | Iterable<readonly [K, V]> | null): ReadonlyMap<K, V>;
|
|
4
|
+
readonly prototype: ReadonlyMap<any, any>;
|
|
5
|
+
}
|
|
6
|
+
/** An alias for the `Map` constructor that returns a read-only map. */
|
|
7
|
+
export declare const ReadonlyMap: ReadonlyMapConstructor;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ReadonlyMap.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ReadonlyMapConstructor {
|
|
2
|
+
new (): ReadonlyMap<any, any>;
|
|
3
|
+
new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | Iterable<readonly [K, V]> | null): ReadonlyMap<K, V>;
|
|
4
|
+
readonly prototype: ReadonlyMap<any, any>;
|
|
5
|
+
}
|
|
6
|
+
/** An alias for the `Map` constructor that returns a read-only map. */
|
|
7
|
+
export declare const ReadonlyMap: ReadonlyMapConstructor;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ReadonlyMap.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ReadonlyMapConstructor {
|
|
2
|
+
new (): ReadonlyMap<any, any>;
|
|
3
|
+
new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | Iterable<readonly [K, V]> | null): ReadonlyMap<K, V>;
|
|
4
|
+
readonly prototype: ReadonlyMap<any, any>;
|
|
5
|
+
}
|
|
6
|
+
/** An alias for the `Map` constructor that returns a read-only map. */
|
|
7
|
+
export declare const ReadonlyMap: ReadonlyMapConstructor;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ReadonlyMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadonlyMap.d.ts","sourceRoot":"","sources":["../../src/types/ReadonlyMap.ts"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC9B,QAAQ,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAC1E,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CAC3C;AAED,uEAAuE;AACvE,eAAO,MAAM,WAAW,EAAU,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to specify that a record should be read-only.
|
|
3
|
+
*
|
|
4
|
+
* This is the same thing as `Readonly<Record<K, V>>`.
|
|
5
|
+
*/
|
|
6
|
+
export type ReadonlyRecord<K extends string | number | symbol, V> = Readonly<Record<K, V>>;
|
|
7
|
+
//# sourceMappingURL=ReadonlyRecord.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to specify that a record should be read-only.
|
|
3
|
+
*
|
|
4
|
+
* This is the same thing as `Readonly<Record<K, V>>`.
|
|
5
|
+
*/
|
|
6
|
+
export type ReadonlyRecord<K extends string | number | symbol, V> = Readonly<Record<K, V>>;
|
|
7
|
+
//# sourceMappingURL=ReadonlyRecord.d.ts.map
|