isaacscript-common 36.2.2 → 37.0.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.
@@ -4112,6 +4112,17 @@ export declare type EntityID = string & {
4112
4112
  readonly __entityIDBrand: symbol;
4113
4113
  };
4114
4114
 
4115
+ /**
4116
+ * Helper type to get a range of integers. It is inclusive on the lower end and exclusive on the
4117
+ * high end. (The "E" in the type name stands for exclusive.)
4118
+ *
4119
+ * For example, `ERange<3, 5>` will return `3 | 4`.
4120
+ *
4121
+ * From:
4122
+ * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
4123
+ */
4124
+ export declare type ERange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThan<High>, NaturalNumbersLessThan<Low>>;
4125
+
4115
4126
  /**
4116
4127
  * Helper function to return an array of integers with the specified range, inclusive on the lower
4117
4128
  * end and exclusive on the high end. (The "e" in the function name stands for exclusive.) Thus,
@@ -7989,6 +8000,17 @@ export declare function inSecretShop(): boolean;
7989
8000
  */
7990
8001
  export declare function inStartingRoom(): boolean;
7991
8002
 
8003
+ /**
8004
+ * Helper type to get a range of integers. It is inclusive on both ends. (The "I" in the type name
8005
+ * stands for inclusive.)
8006
+ *
8007
+ * For example, `IRange<3, 5>` will return `3 | 4 | 5`.
8008
+ *
8009
+ * From:
8010
+ * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
8011
+ */
8012
+ export declare type IRange<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
8013
+
7992
8014
  /**
7993
8015
  * Helper function to return an array of integers with the specified range, inclusive on both ends.
7994
8016
  * (The "i" in the function name stands for inclusive.)
@@ -13593,7 +13615,7 @@ export declare type NaturalNumbersLessThan<N extends number, Acc extends number[
13593
13615
  * From:
13594
13616
  * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
13595
13617
  */
13596
- export declare 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"]]>;
13618
+ export declare type NaturalNumbersLessThanOrEqualTo<N extends number, Acc extends number[] = []> = Acc extends [unknown, ...infer Tail] ? Tail["length"] extends N ? Acc[number] : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]> : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]>;
13597
13619
 
13598
13620
  /** This is near the top door. */
13599
13621
  export declare const NEW_FLOOR_STARTING_POSITION_GREED_MODE: Readonly<Vector>;
@@ -14647,16 +14669,6 @@ declare interface QueueElement {
14647
14669
  renderOffset: Vector;
14648
14670
  }
14649
14671
 
14650
- /**
14651
- * Helper type to get a range of integers. It is inclusive on both ends.
14652
- *
14653
- * For example, `Range<3, 5>` will return `3 | 4 | 5`.
14654
- *
14655
- * From:
14656
- * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
14657
- */
14658
- export declare type Range<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
14659
-
14660
14672
  /** An alias for the `Map` constructor that returns a read-only map. */
14661
14673
  declare const ReadonlyMap_2: ReadonlyMapConstructor;
14662
14674
  export { ReadonlyMap_2 as ReadonlyMap }
@@ -17468,6 +17480,14 @@ export declare interface TSTLClassMetatable {
17468
17480
  */
17469
17481
  export declare type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
17470
17482
 
17483
+ /**
17484
+ * Helper type to get the valid indexes for a tuple. For example, using a tuple of length 3 will
17485
+ * return `0 | 1 | 2`.
17486
+ */
17487
+ export declare type TupleKeys<T extends {
17488
+ length: number;
17489
+ }> = ERange<0, T["length"]>;
17490
+
17471
17491
  declare type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
17472
17492
 
17473
17493
  export declare type TupleToIntersection<T extends unknown[]> = T extends [
@@ -17485,7 +17505,7 @@ export declare type TupleToUnion<T extends unknown[]> = T[number];
17485
17505
  * For example, `TupleWithLengthBetween<string, 2, 4>` will allow string tuples of size 2, 3, or 4.
17486
17506
  */
17487
17507
  export declare type TupleWithLengthBetween<T, MinLength extends number, MaxLength extends number> = (T[] | readonly T[]) & {
17488
- length: Range<MinLength, MaxLength>;
17508
+ length: IRange<MinLength, MaxLength>;
17489
17509
  };
17490
17510
 
17491
17511
  /**
@@ -17494,7 +17514,7 @@ export declare type TupleWithLengthBetween<T, MinLength extends number, MaxLengt
17494
17514
  * For example, `TupleWithMaxLength<string, 3>` will allow string tuples of size 0, 1, 2, or 3.
17495
17515
  */
17496
17516
  export declare type TupleWithMaxLength<T, MaxLength extends number> = (T[] | readonly T[]) & {
17497
- length: Range<0, MaxLength>;
17517
+ length: IRange<0, MaxLength>;
17498
17518
  };
17499
17519
 
17500
17520
  /**
@@ -17646,7 +17666,7 @@ export declare function vectorToString(vector: Vector, round?: boolean): string;
17646
17666
  */
17647
17667
  export declare const VectorZero: Readonly<Vector>;
17648
17668
 
17649
- /** An array where each element is paired with a number indicating that elements 'weight'. */
17669
+ /** An array where each element is paired with a number indicating that element's weight. */
17650
17670
  export declare type WeightedArray<T> = Array<[T, float]>;
17651
17671
 
17652
17672
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 36.2.2
3
+ isaacscript-common 37.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -54352,35 +54352,39 @@ return ____exports
54352
54352
  local ____exports = {}
54353
54353
  return ____exports
54354
54354
  end,
54355
- ["src.types.Expand"] = function(...)
54355
+ ["src.types.NaturalNumbersLessThan"] = function(...)
54356
54356
  local ____exports = {}
54357
54357
  return ____exports
54358
54358
  end,
54359
- ["src.types.HasFunction"] = function(...)
54359
+ ["src.types.ERange"] = function(...)
54360
54360
  local ____exports = {}
54361
54361
  return ____exports
54362
54362
  end,
54363
- ["src.types.Increment"] = function(...)
54363
+ ["src.types.Expand"] = function(...)
54364
54364
  local ____exports = {}
54365
54365
  return ____exports
54366
54366
  end,
54367
- ["src.types.StartsWithLowercase"] = function(...)
54367
+ ["src.types.HasFunction"] = function(...)
54368
54368
  local ____exports = {}
54369
54369
  return ____exports
54370
54370
  end,
54371
- ["src.types.LowercaseKeys"] = function(...)
54371
+ ["src.types.NaturalNumbersLessThanOrEqualTo"] = function(...)
54372
54372
  local ____exports = {}
54373
54373
  return ____exports
54374
54374
  end,
54375
- ["src.types.NaturalNumbersLessThan"] = function(...)
54375
+ ["src.types.IRange"] = function(...)
54376
54376
  local ____exports = {}
54377
54377
  return ____exports
54378
54378
  end,
54379
- ["src.types.NaturalNumbersLessThanOrEqualTo"] = function(...)
54379
+ ["src.types.Increment"] = function(...)
54380
+ local ____exports = {}
54381
+ return ____exports
54382
+ end,
54383
+ ["src.types.StartsWithLowercase"] = function(...)
54380
54384
  local ____exports = {}
54381
54385
  return ____exports
54382
54386
  end,
54383
- ["src.types.Range"] = function(...)
54387
+ ["src.types.LowercaseKeys"] = function(...)
54384
54388
  local ____exports = {}
54385
54389
  return ____exports
54386
54390
  end,
@@ -54390,6 +54394,10 @@ return ____exports
54390
54394
  end,
54391
54395
  ["src.types.Tuple"] = function(...)
54392
54396
  local ____exports = {}
54397
+ return ____exports
54398
+ end,
54399
+ ["src.types.TupleKeys"] = function(...)
54400
+ local ____exports = {}
54393
54401
  return ____exports
54394
54402
  end,
54395
54403
  ["src.types.TupleToUnion"] = function(...)
@@ -157,11 +157,13 @@ export * from "./types/AnyFunction";
157
157
  export * from "./types/AnyGridEntity";
158
158
  export * from "./types/ConversionHeartSubType";
159
159
  export * from "./types/Decrement";
160
+ export * from "./types/ERange";
160
161
  export * from "./types/EntityID";
161
162
  export * from "./types/Expand";
162
163
  export * from "./types/FunctionTuple";
163
164
  export * from "./types/GridEntityID";
164
165
  export * from "./types/HasFunction";
166
+ export * from "./types/IRange";
165
167
  export * from "./types/Immutable";
166
168
  export * from "./types/Increment";
167
169
  export * from "./types/LowercaseKeys";
@@ -172,13 +174,13 @@ export * from "./types/PickupIndex";
172
174
  export * from "./types/PlayerIndex";
173
175
  export * from "./types/PossibleStatType";
174
176
  export * from "./types/PublicInterface";
175
- export * from "./types/Range";
176
177
  export * from "./types/ReadonlyMap";
177
178
  export * from "./types/ReadonlySet";
178
179
  export * from "./types/StartsWithLowercase";
179
180
  export * from "./types/StartsWithUppercase";
180
181
  export * from "./types/TSTLClass";
181
182
  export * from "./types/Tuple";
183
+ export * from "./types/TupleKeys";
182
184
  export * from "./types/TupleToIntersection";
183
185
  export * from "./types/TupleToUnion";
184
186
  export * from "./types/TupleWithLengthBetween";
@@ -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,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,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cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
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,0BAA0B,CAAC;AAEvE;;;;;;;;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"}
@@ -1,12 +1,13 @@
1
1
  import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
2
2
  import type { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersLessThanOrEqualTo";
3
3
  /**
4
- * Helper type to get a range of integers. It is inclusive on both ends.
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.)
5
6
  *
6
- * For example, `Range<3, 5>` will return `3 | 4 | 5`.
7
+ * For example, `IRange<3, 5>` will return `3 | 4 | 5`.
7
8
  *
8
9
  * From:
9
10
  * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
10
11
  */
11
- export type Range<Low extends number, High extends number> = Exclude<NaturalNumbersLessThanOrEqualTo<High>, NaturalNumbersLessThan<Low>>;
12
- //# sourceMappingURL=Range.d.ts.map
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,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEzF;;;;;;;;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,2 @@
1
+ local ____exports = {}
2
+ return ____exports
@@ -4,5 +4,5 @@
4
4
  * From:
5
5
  * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
6
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"]]>;
7
+ export type NaturalNumbersLessThanOrEqualTo<N extends number, Acc extends number[] = []> = Acc extends [unknown, ...infer Tail] ? Tail["length"] extends N ? Acc[number] : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]> : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]>;
8
8
  //# sourceMappingURL=NaturalNumbersLessThanOrEqualTo.d.ts.map
@@ -1 +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"}
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,GAAG,SAAS,MAAM,EAAE,GAAG,EAAE,IACvB,GAAG,SAAS,CAAC,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,GACpC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GACtB,GAAG,CAAC,MAAM,CAAC,GACX,+BAA+B,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAC7D,+BAA+B,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ERange } from "./ERange";
2
+ /**
3
+ * Helper type to get the valid indexes for a tuple. For example, using a tuple of length 3 will
4
+ * return `0 | 1 | 2`.
5
+ */
6
+ export type TupleKeys<T extends {
7
+ length: number;
8
+ }> = ERange<0, T["length"]>;
9
+ //# sourceMappingURL=TupleKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TupleKeys.d.ts","sourceRoot":"","sources":["../../../src/types/TupleKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ local ____exports = {}
2
+ return ____exports
@@ -1,4 +1,4 @@
1
- import type { Range } from "./Range";
1
+ import type { IRange } from "./IRange";
2
2
  /**
3
3
  * Helper type that validates that a tuple has a length between `MinLength` and `MaxLength`
4
4
  * (inclusive on both ends).
@@ -6,6 +6,6 @@ import type { Range } from "./Range";
6
6
  * For example, `TupleWithLengthBetween<string, 2, 4>` will allow string tuples of size 2, 3, or 4.
7
7
  */
8
8
  export type TupleWithLengthBetween<T, MinLength extends number, MaxLength extends number> = (T[] | readonly T[]) & {
9
- length: Range<MinLength, MaxLength>;
9
+ length: IRange<MinLength, MaxLength>;
10
10
  };
11
11
  //# sourceMappingURL=TupleWithLengthBetween.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TupleWithLengthBetween.d.ts","sourceRoot":"","sources":["../../../src/types/TupleWithLengthBetween.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,CAChC,CAAC,EACD,SAAS,SAAS,MAAM,EACxB,SAAS,SAAS,MAAM,IACtB,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,GAAG;IACzB,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC"}
1
+ {"version":3,"file":"TupleWithLengthBetween.d.ts","sourceRoot":"","sources":["../../../src/types/TupleWithLengthBetween.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,CAChC,CAAC,EACD,SAAS,SAAS,MAAM,EACxB,SAAS,SAAS,MAAM,IACtB,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CACtC,CAAC"}
@@ -1,10 +1,10 @@
1
- import type { Range } from "./Range";
1
+ import type { IRange } from "./IRange";
2
2
  /**
3
3
  * Helper type that validates that a tuple does not have a length greater than N.
4
4
  *
5
5
  * For example, `TupleWithMaxLength<string, 3>` will allow string tuples of size 0, 1, 2, or 3.
6
6
  */
7
7
  export type TupleWithMaxLength<T, MaxLength extends number> = (T[] | readonly T[]) & {
8
- length: Range<0, MaxLength>;
8
+ length: IRange<0, MaxLength>;
9
9
  };
10
10
  //# sourceMappingURL=TupleWithMaxLength.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TupleWithMaxLength.d.ts","sourceRoot":"","sources":["../../../src/types/TupleWithMaxLength.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,SAAS,SAAS,MAAM,IAAI,CAC1D,CAAC,EAAE,GACH,SAAS,CAAC,EAAE,CACf,GAAG;IACF,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;CAC7B,CAAC"}
1
+ {"version":3,"file":"TupleWithMaxLength.d.ts","sourceRoot":"","sources":["../../../src/types/TupleWithMaxLength.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,SAAS,SAAS,MAAM,IAAI,CAC1D,CAAC,EAAE,GACH,SAAS,CAAC,EAAE,CACf,GAAG;IACF,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;CAC9B,CAAC"}
@@ -1,4 +1,4 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- /** An array where each element is paired with a number indicating that elements 'weight'. */
2
+ /** An array where each element is paired with a number indicating that element's weight. */
3
3
  export type WeightedArray<T> = Array<[T, float]>;
4
4
  //# sourceMappingURL=WeightedArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WeightedArray.d.ts","sourceRoot":"","sources":["../../../src/types/WeightedArray.ts"],"names":[],"mappings":";AAAA,6FAA6F;AAC7F,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"WeightedArray.d.ts","sourceRoot":"","sources":["../../../src/types/WeightedArray.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "36.2.2",
3
+ "version": "37.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
package/src/index.ts CHANGED
@@ -157,11 +157,13 @@ export * from "./types/AnyFunction";
157
157
  export * from "./types/AnyGridEntity";
158
158
  export * from "./types/ConversionHeartSubType";
159
159
  export * from "./types/Decrement";
160
+ export * from "./types/ERange";
160
161
  export * from "./types/EntityID";
161
162
  export * from "./types/Expand";
162
163
  export * from "./types/FunctionTuple";
163
164
  export * from "./types/GridEntityID";
164
165
  export * from "./types/HasFunction";
166
+ export * from "./types/IRange";
165
167
  export * from "./types/Immutable";
166
168
  export * from "./types/Increment";
167
169
  export * from "./types/LowercaseKeys";
@@ -172,13 +174,13 @@ export * from "./types/PickupIndex";
172
174
  export * from "./types/PlayerIndex";
173
175
  export * from "./types/PossibleStatType";
174
176
  export * from "./types/PublicInterface";
175
- export * from "./types/Range";
176
177
  export * from "./types/ReadonlyMap";
177
178
  export * from "./types/ReadonlySet";
178
179
  export * from "./types/StartsWithLowercase";
179
180
  export * from "./types/StartsWithUppercase";
180
181
  export * from "./types/TSTLClass";
181
182
  export * from "./types/Tuple";
183
+ export * from "./types/TupleKeys";
182
184
  export * from "./types/TupleToIntersection";
183
185
  export * from "./types/TupleToUnion";
184
186
  export * from "./types/TupleWithLengthBetween";
@@ -0,0 +1,15 @@
1
+ import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
2
+
3
+ /**
4
+ * Helper type to get a range of integers. It is inclusive on the lower end and exclusive on the
5
+ * high end. (The "E" in the type name stands for exclusive.)
6
+ *
7
+ * For example, `ERange<3, 5>` will return `3 | 4`.
8
+ *
9
+ * From:
10
+ * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
11
+ */
12
+ export type ERange<Low extends number, High extends number> = Exclude<
13
+ NaturalNumbersLessThan<High>,
14
+ NaturalNumbersLessThan<Low>
15
+ >;
@@ -2,14 +2,15 @@ import type { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
2
2
  import type { NaturalNumbersLessThanOrEqualTo } from "./NaturalNumbersLessThanOrEqualTo";
3
3
 
4
4
  /**
5
- * Helper type to get a range of integers. It is inclusive on both ends.
5
+ * Helper type to get a range of integers. It is inclusive on both ends. (The "I" in the type name
6
+ * stands for inclusive.)
6
7
  *
7
- * For example, `Range<3, 5>` will return `3 | 4 | 5`.
8
+ * For example, `IRange<3, 5>` will return `3 | 4 | 5`.
8
9
  *
9
10
  * From:
10
11
  * https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
11
12
  */
12
- export type Range<Low extends number, High extends number> = Exclude<
13
+ export type IRange<Low extends number, High extends number> = Exclude<
13
14
  NaturalNumbersLessThanOrEqualTo<High>,
14
15
  NaturalNumbersLessThan<Low>
15
16
  >;
@@ -6,9 +6,9 @@
6
6
  */
7
7
  export type NaturalNumbersLessThanOrEqualTo<
8
8
  N extends number,
9
- T extends number[] = [],
10
- > = T extends [unknown, ...infer Tail]
9
+ Acc extends number[] = [],
10
+ > = Acc extends [unknown, ...infer Tail]
11
11
  ? Tail["length"] extends N
12
- ? T[number]
13
- : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]>
14
- : NaturalNumbersLessThanOrEqualTo<N, [...T, T["length"]]>;
12
+ ? Acc[number]
13
+ : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]>
14
+ : NaturalNumbersLessThanOrEqualTo<N, [...Acc, Acc["length"]]>;
@@ -0,0 +1,7 @@
1
+ import type { ERange } from "./ERange";
2
+
3
+ /**
4
+ * Helper type to get the valid indexes for a tuple. For example, using a tuple of length 3 will
5
+ * return `0 | 1 | 2`.
6
+ */
7
+ export type TupleKeys<T extends { length: number }> = ERange<0, T["length"]>;
@@ -1,4 +1,4 @@
1
- import type { Range } from "./Range";
1
+ import type { IRange } from "./IRange";
2
2
 
3
3
  /**
4
4
  * Helper type that validates that a tuple has a length between `MinLength` and `MaxLength`
@@ -11,7 +11,7 @@ export type TupleWithLengthBetween<
11
11
  MinLength extends number,
12
12
  MaxLength extends number,
13
13
  > = (T[] | readonly T[]) & {
14
- length: Range<MinLength, MaxLength>;
14
+ length: IRange<MinLength, MaxLength>;
15
15
  };
16
16
 
17
17
  // -----
@@ -1,4 +1,4 @@
1
- import type { Range } from "./Range";
1
+ import type { IRange } from "./IRange";
2
2
 
3
3
  /**
4
4
  * Helper type that validates that a tuple does not have a length greater than N.
@@ -9,7 +9,7 @@ export type TupleWithMaxLength<T, MaxLength extends number> = (
9
9
  | T[]
10
10
  | readonly T[]
11
11
  ) & {
12
- length: Range<0, MaxLength>;
12
+ length: IRange<0, MaxLength>;
13
13
  };
14
14
 
15
15
  // -----
@@ -1,2 +1,2 @@
1
- /** An array where each element is paired with a number indicating that elements 'weight'. */
1
+ /** An array where each element is paired with a number indicating that element's weight. */
2
2
  export type WeightedArray<T> = Array<[T, float]>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../../src/types/Range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEzF;;;;;;;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"}
File without changes