isaacscript-common 27.3.0 → 27.5.0
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/dist/index.rollup.d.ts +44 -3
- package/dist/isaacscript-common.lua +21 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types/Decrement.d.ts +8 -0
- package/dist/src/types/Decrement.d.ts.map +1 -0
- package/dist/src/types/Decrement.lua +2 -0
- package/dist/src/types/Increment.d.ts +8 -0
- package/dist/src/types/Increment.d.ts.map +1 -0
- package/dist/src/types/Increment.lua +2 -0
- package/dist/src/types/NaturalNumbersEqualToOrLessThan.d.ts +10 -0
- package/dist/src/types/NaturalNumbersEqualToOrLessThan.d.ts.map +1 -0
- package/dist/src/types/NaturalNumbersEqualToOrLessThan.lua +2 -0
- package/dist/src/types/Range.d.ts +5 -3
- package/dist/src/types/Range.d.ts.map +1 -1
- package/dist/src/types/Tuple.d.ts +9 -0
- package/dist/src/types/Tuple.d.ts.map +1 -0
- package/dist/src/types/Tuple.lua +2 -0
- package/dist/src/types/TupleWithMaxLength.d.ts +10 -0
- package/dist/src/types/TupleWithMaxLength.d.ts.map +1 -0
- package/dist/src/types/TupleWithMaxLength.lua +2 -0
- package/package.json +1 -1
- package/src/index.ts +5 -0
- package/src/types/Decrement.ts +10 -0
- package/src/types/Increment.ts +8 -0
- package/src/types/NaturalNumbersLessThanOrEqualTo.ts +12 -0
- package/src/types/Range.ts +5 -3
- package/src/types/Tuple.ts +11 -0
- package/src/types/TupleWithMaxLength.ts +13 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -2954,6 +2954,13 @@ declare class DebugDisplay extends Feature {
|
|
|
2954
2954
|
togglePressurePlateDisplay(force?: boolean): void;
|
|
2955
2955
|
}
|
|
2956
2956
|
|
|
2957
|
+
/**
|
|
2958
|
+
* Helper type to subtract one from a number type.
|
|
2959
|
+
*
|
|
2960
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
2961
|
+
*/
|
|
2962
|
+
export declare type Decrement<N extends number> = Tuple<N> extends [unknown, ...infer U] ? U["length"] : never;
|
|
2963
|
+
|
|
2957
2964
|
/**
|
|
2958
2965
|
* `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
|
|
2959
2966
|
* of the nested references remain.
|
|
@@ -7144,6 +7151,13 @@ export declare function includes<T>(array: T[], element: T): boolean;
|
|
|
7144
7151
|
*/
|
|
7145
7152
|
export declare function inCrawlSpace(): boolean;
|
|
7146
7153
|
|
|
7154
|
+
/**
|
|
7155
|
+
* Helper type to add one to a number type.
|
|
7156
|
+
*
|
|
7157
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
7158
|
+
*/
|
|
7159
|
+
export declare type Increment<N extends number> = [...Tuple<N>, unknown]["length"];
|
|
7160
|
+
|
|
7147
7161
|
/**
|
|
7148
7162
|
* Helper function to detect if the current room is one of the rooms in the Death Certificate area.
|
|
7149
7163
|
*/
|
|
@@ -12053,6 +12067,14 @@ export declare enum MysteriousPaperEffect {
|
|
|
12053
12067
|
*/
|
|
12054
12068
|
export declare type NaturalNumbersLessThan<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : NaturalNumbersLessThan<N, [...Acc, Acc["length"]]>;
|
|
12055
12069
|
|
|
12070
|
+
/**
|
|
12071
|
+
* Helper type to get a range of integers between 0 and N.
|
|
12072
|
+
*
|
|
12073
|
+
* From:
|
|
12074
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
12075
|
+
*/
|
|
12076
|
+
export declare type NaturalNumbersLessThanOrEqualTo<N extends number> = NaturalNumbersLessThan<Increment<N>>;
|
|
12077
|
+
|
|
12056
12078
|
/** This is near the top door. */
|
|
12057
12079
|
export declare const NEW_FLOOR_STARTING_POSITION_GREED_MODE: Readonly<Vector>;
|
|
12058
12080
|
|
|
@@ -12919,13 +12941,14 @@ declare interface QueueElement {
|
|
|
12919
12941
|
}
|
|
12920
12942
|
|
|
12921
12943
|
/**
|
|
12922
|
-
* Helper type to get a range of integers
|
|
12923
|
-
*
|
|
12944
|
+
* Helper type to get a range of integers. It is inclusive on both ends.
|
|
12945
|
+
*
|
|
12946
|
+
* For example, `Range<3, 5>` will return `3 | 4 | 5`.
|
|
12924
12947
|
*
|
|
12925
12948
|
* From:
|
|
12926
12949
|
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
12927
12950
|
*/
|
|
12928
|
-
export declare type Range<Low extends number, High extends number> = Exclude<
|
|
12951
|
+
export declare type Range<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
|
|
12929
12952
|
|
|
12930
12953
|
/** An alias for the `Map` constructor that returns a read-only map. */
|
|
12931
12954
|
declare const ReadonlyMap_2: ReadonlyMapConstructor;
|
|
@@ -15691,6 +15714,15 @@ export declare interface TSTLClassMetatable {
|
|
|
15691
15714
|
};
|
|
15692
15715
|
}
|
|
15693
15716
|
|
|
15717
|
+
/**
|
|
15718
|
+
* Helper type to represent a tuple of length N.
|
|
15719
|
+
*
|
|
15720
|
+
* This is used by the `Increment` and `Decrement` helper types.
|
|
15721
|
+
*
|
|
15722
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
15723
|
+
*/
|
|
15724
|
+
export declare type Tuple<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Tuple<N, [...T, unknown]>;
|
|
15725
|
+
|
|
15694
15726
|
export declare type TupleToIntersection<T extends unknown[]> = T extends [
|
|
15695
15727
|
infer F,
|
|
15696
15728
|
...infer R
|
|
@@ -15699,6 +15731,15 @@ infer F,
|
|
|
15699
15731
|
/** Helper type to convert a tuple to a union. */
|
|
15700
15732
|
export declare type TupleToUnion<T extends unknown[]> = T[number];
|
|
15701
15733
|
|
|
15734
|
+
/**
|
|
15735
|
+
* Helper type that validates that a tuple does not have a length greater than N.
|
|
15736
|
+
*
|
|
15737
|
+
* For example, `TupleWithMaxLength<string, 3>` will allow string tuples of size 0, 1, 2, or 3.
|
|
15738
|
+
*/
|
|
15739
|
+
export declare type TupleWithMaxLength<T, MaxLength extends number> = (T[] | readonly T[]) & {
|
|
15740
|
+
length: NaturalNumbersLessThanOrEqualTo<MaxLength>;
|
|
15741
|
+
};
|
|
15742
|
+
|
|
15702
15743
|
/**
|
|
15703
15744
|
* This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
|
15704
15745
|
* corner.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 27.
|
|
3
|
+
isaacscript-common 27.5.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -52250,10 +52250,22 @@ return ____exports
|
|
|
52250
52250
|
end,
|
|
52251
52251
|
["src.types.AllButLast"] = function(...)
|
|
52252
52252
|
local ____exports = {}
|
|
52253
|
+
return ____exports
|
|
52254
|
+
end,
|
|
52255
|
+
["src.types.Tuple"] = function(...)
|
|
52256
|
+
local ____exports = {}
|
|
52257
|
+
return ____exports
|
|
52258
|
+
end,
|
|
52259
|
+
["src.types.Decrement"] = function(...)
|
|
52260
|
+
local ____exports = {}
|
|
52253
52261
|
return ____exports
|
|
52254
52262
|
end,
|
|
52255
52263
|
["src.types.HasFunction"] = function(...)
|
|
52256
52264
|
local ____exports = {}
|
|
52265
|
+
return ____exports
|
|
52266
|
+
end,
|
|
52267
|
+
["src.types.Increment"] = function(...)
|
|
52268
|
+
local ____exports = {}
|
|
52257
52269
|
return ____exports
|
|
52258
52270
|
end,
|
|
52259
52271
|
["src.types.StartsWithLowercase"] = function(...)
|
|
@@ -52266,6 +52278,10 @@ return ____exports
|
|
|
52266
52278
|
end,
|
|
52267
52279
|
["src.types.NaturalNumbersLessThan"] = function(...)
|
|
52268
52280
|
local ____exports = {}
|
|
52281
|
+
return ____exports
|
|
52282
|
+
end,
|
|
52283
|
+
["src.types.NaturalNumbersLessThanOrEqualTo"] = function(...)
|
|
52284
|
+
local ____exports = {}
|
|
52269
52285
|
return ____exports
|
|
52270
52286
|
end,
|
|
52271
52287
|
["src.types.Range"] = function(...)
|
|
@@ -52278,6 +52294,10 @@ return ____exports
|
|
|
52278
52294
|
end,
|
|
52279
52295
|
["src.types.TupleToUnion"] = function(...)
|
|
52280
52296
|
local ____exports = {}
|
|
52297
|
+
return ____exports
|
|
52298
|
+
end,
|
|
52299
|
+
["src.types.TupleWithMaxLength"] = function(...)
|
|
52300
|
+
local ____exports = {}
|
|
52281
52301
|
return ____exports
|
|
52282
52302
|
end,
|
|
52283
52303
|
["src.types.UnionToIntersection"] = function(...)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -153,12 +153,15 @@ export * from "./types/AnyFunction";
|
|
|
153
153
|
export * from "./types/AnyGridEntity";
|
|
154
154
|
export * from "./types/CollectibleIndex";
|
|
155
155
|
export * from "./types/ConversionHeartSubType";
|
|
156
|
+
export * from "./types/Decrement";
|
|
156
157
|
export * from "./types/EntityID";
|
|
157
158
|
export * from "./types/FunctionTuple";
|
|
158
159
|
export * from "./types/GridEntityID";
|
|
159
160
|
export * from "./types/HasFunction";
|
|
160
161
|
export * from "./types/Immutable";
|
|
162
|
+
export * from "./types/Increment";
|
|
161
163
|
export * from "./types/LowercaseKeys";
|
|
164
|
+
export * from "./types/NaturalNumbersEqualToOrLessThan";
|
|
162
165
|
export * from "./types/NaturalNumbersLessThan";
|
|
163
166
|
export * from "./types/PickingUpItem";
|
|
164
167
|
export * from "./types/PickupIndex";
|
|
@@ -171,8 +174,10 @@ export * from "./types/ReadonlySet";
|
|
|
171
174
|
export * from "./types/StartsWithLowercase";
|
|
172
175
|
export * from "./types/StartsWithUppercase";
|
|
173
176
|
export * from "./types/TSTLClass";
|
|
177
|
+
export * from "./types/Tuple";
|
|
174
178
|
export * from "./types/TupleToIntersection";
|
|
175
179
|
export * from "./types/TupleToUnion";
|
|
180
|
+
export * from "./types/TupleWithMaxLength";
|
|
176
181
|
export * from "./types/UnionToIntersection";
|
|
177
182
|
export * from "./types/UppercaseKeys";
|
|
178
183
|
export * from "./types/WeightedArray";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAA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cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tuple } from "./Tuple";
|
|
2
|
+
/**
|
|
3
|
+
* Helper type to subtract one from a number type.
|
|
4
|
+
*
|
|
5
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
6
|
+
*/
|
|
7
|
+
export type Decrement<N extends number> = Tuple<N> extends [unknown, ...infer U] ? U["length"] : never;
|
|
8
|
+
//# sourceMappingURL=Decrement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decrement.d.ts","sourceRoot":"","sources":["../../../src/types/Decrement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,GAC5E,CAAC,CAAC,QAAQ,CAAC,GACX,KAAK,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tuple } from "./Tuple";
|
|
2
|
+
/**
|
|
3
|
+
* Helper type to add one to a number type.
|
|
4
|
+
*
|
|
5
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
6
|
+
*/
|
|
7
|
+
export type Increment<N extends number> = [...Tuple<N>, unknown]["length"];
|
|
8
|
+
//# sourceMappingURL=Increment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Increment.d.ts","sourceRoot":"","sources":["../../../src/types/Increment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Increment } from "./Increment";
|
|
2
|
+
import { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
|
|
3
|
+
/**
|
|
4
|
+
* Helper type to get a range of integers between 0 and N.
|
|
5
|
+
*
|
|
6
|
+
* From:
|
|
7
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
8
|
+
*/
|
|
9
|
+
export type NaturalNumbersLessThanOrEqualTo<N extends number> = NaturalNumbersLessThan<Increment<N>>;
|
|
10
|
+
//# sourceMappingURL=NaturalNumbersEqualToOrLessThan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NaturalNumbersEqualToOrLessThan.d.ts","sourceRoot":"","sources":["../../../src/types/NaturalNumbersEqualToOrLessThan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,+BAA+B,CAAC,CAAC,SAAS,MAAM,IAE1D,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersEqualToOrLessThan";
|
|
1
2
|
import { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
|
|
2
3
|
/**
|
|
3
|
-
* Helper type to get a range of integers
|
|
4
|
-
*
|
|
4
|
+
* Helper type to get a range of integers. It is inclusive on both ends.
|
|
5
|
+
*
|
|
6
|
+
* For example, `Range<3, 5>` will return `3 | 4 | 5`.
|
|
5
7
|
*
|
|
6
8
|
* From:
|
|
7
9
|
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
8
10
|
*/
|
|
9
|
-
export type Range<Low extends number, High extends number> = Exclude<
|
|
11
|
+
export type Range<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
|
|
10
12
|
//# sourceMappingURL=Range.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../../src/types/Range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE
|
|
1
|
+
{"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../../src/types/Range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,MAAM,KAAK,CAAC,GAAG,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,OAAO,CAClE,+BAA+B,CAAC,IAAI,CAAC,EACrC,sBAAsB,CAAC,GAAG,CAAC,CAC5B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to represent a tuple of length N.
|
|
3
|
+
*
|
|
4
|
+
* This is used by the `Increment` and `Decrement` helper types.
|
|
5
|
+
*
|
|
6
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
7
|
+
*/
|
|
8
|
+
export type Tuple<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Tuple<N, [...T, unknown]>;
|
|
9
|
+
//# sourceMappingURL=Tuple.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tuple.d.ts","sourceRoot":"","sources":["../../../src/types/Tuple.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,CACf,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,IACtB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersEqualToOrLessThan";
|
|
2
|
+
/**
|
|
3
|
+
* Helper type that validates that a tuple does not have a length greater than N.
|
|
4
|
+
*
|
|
5
|
+
* For example, `TupleWithMaxLength<string, 3>` will allow string tuples of size 0, 1, 2, or 3.
|
|
6
|
+
*/
|
|
7
|
+
export type TupleWithMaxLength<T, MaxLength extends number> = (T[] | readonly T[]) & {
|
|
8
|
+
length: NaturalNumbersLessThanOrEqualTo<MaxLength>;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=TupleWithMaxLength.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TupleWithMaxLength.d.ts","sourceRoot":"","sources":["../../../src/types/TupleWithMaxLength.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,SAAS,SAAS,MAAM,IAAI,CAC1D,CAAC,EAAE,GACH,SAAS,CAAC,EAAE,CACf,GAAG;IACF,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC;CACpD,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -153,13 +153,16 @@ export * from "./types/AnyFunction";
|
|
|
153
153
|
export * from "./types/AnyGridEntity";
|
|
154
154
|
export * from "./types/CollectibleIndex";
|
|
155
155
|
export * from "./types/ConversionHeartSubType";
|
|
156
|
+
export * from "./types/Decrement";
|
|
156
157
|
export * from "./types/EntityID";
|
|
157
158
|
export * from "./types/FunctionTuple";
|
|
158
159
|
export * from "./types/GridEntityID";
|
|
159
160
|
export * from "./types/HasFunction";
|
|
160
161
|
export * from "./types/Immutable";
|
|
162
|
+
export * from "./types/Increment";
|
|
161
163
|
export * from "./types/LowercaseKeys";
|
|
162
164
|
export * from "./types/NaturalNumbersLessThan";
|
|
165
|
+
export * from "./types/NaturalNumbersLessThanOrEqualTo";
|
|
163
166
|
export * from "./types/PickingUpItem";
|
|
164
167
|
export * from "./types/PickupIndex";
|
|
165
168
|
export * from "./types/PlayerIndex";
|
|
@@ -171,8 +174,10 @@ export * from "./types/ReadonlySet";
|
|
|
171
174
|
export * from "./types/StartsWithLowercase";
|
|
172
175
|
export * from "./types/StartsWithUppercase";
|
|
173
176
|
export * from "./types/TSTLClass";
|
|
177
|
+
export * from "./types/Tuple";
|
|
174
178
|
export * from "./types/TupleToIntersection";
|
|
175
179
|
export * from "./types/TupleToUnion";
|
|
180
|
+
export * from "./types/TupleWithMaxLength";
|
|
176
181
|
export * from "./types/UnionToIntersection";
|
|
177
182
|
export * from "./types/UppercaseKeys";
|
|
178
183
|
export * from "./types/WeightedArray";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Tuple } from "./Tuple";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper type to subtract one from a number type.
|
|
5
|
+
*
|
|
6
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
7
|
+
*/
|
|
8
|
+
export type Decrement<N extends number> = Tuple<N> extends [unknown, ...infer U]
|
|
9
|
+
? U["length"]
|
|
10
|
+
: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Increment } from "./Increment";
|
|
2
|
+
import { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Helper type to get a range of integers between 0 and N.
|
|
6
|
+
*
|
|
7
|
+
* From:
|
|
8
|
+
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
9
|
+
*/
|
|
10
|
+
export type NaturalNumbersLessThanOrEqualTo<N extends number> =
|
|
11
|
+
// @ts-expect-error The return value of increment is a number, but TypeScript gets confused.
|
|
12
|
+
NaturalNumbersLessThan<Increment<N>>;
|
package/src/types/Range.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
|
|
2
|
+
import { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersLessThanOrEqualTo";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* Helper type to get a range of integers
|
|
5
|
-
*
|
|
5
|
+
* Helper type to get a range of integers. It is inclusive on both ends.
|
|
6
|
+
*
|
|
7
|
+
* For example, `Range<3, 5>` will return `3 | 4 | 5`.
|
|
6
8
|
*
|
|
7
9
|
* From:
|
|
8
10
|
* https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
|
|
9
11
|
*/
|
|
10
12
|
export type Range<Low extends number, High extends number> = Exclude<
|
|
11
|
-
|
|
13
|
+
NaturalNumbersLessThanOrEqualTo<High>,
|
|
12
14
|
NaturalNumbersLessThan<Low>
|
|
13
15
|
>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to represent a tuple of length N.
|
|
3
|
+
*
|
|
4
|
+
* This is used by the `Increment` and `Decrement` helper types.
|
|
5
|
+
*
|
|
6
|
+
* From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
|
|
7
|
+
*/
|
|
8
|
+
export type Tuple<
|
|
9
|
+
N extends number,
|
|
10
|
+
T extends unknown[] = [],
|
|
11
|
+
> = T["length"] extends N ? T : Tuple<N, [...T, unknown]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersLessThanOrEqualTo";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper type that validates that a tuple does not have a length greater than N.
|
|
5
|
+
*
|
|
6
|
+
* For example, `TupleWithMaxLength<string, 3>` will allow string tuples of size 0, 1, 2, or 3.
|
|
7
|
+
*/
|
|
8
|
+
export type TupleWithMaxLength<T, MaxLength extends number> = (
|
|
9
|
+
| T[]
|
|
10
|
+
| readonly T[]
|
|
11
|
+
) & {
|
|
12
|
+
length: NaturalNumbersLessThanOrEqualTo<MaxLength>;
|
|
13
|
+
};
|