isaacscript-common 31.2.1 → 31.2.2

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.
@@ -1035,6 +1035,10 @@ export declare function anyPlayerHoldingItem(): boolean;
1035
1035
  */
1036
1036
  export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolean;
1037
1037
 
1038
+ declare type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>;
1039
+
1040
+ declare type Arr_2<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr_2<N, [...T, unknown]>;
1041
+
1038
1042
  /**
1039
1043
  * Helper function for determining if two arrays contain the exact same elements. Note that this
1040
1044
  * only performs a shallow comparison.
@@ -3196,7 +3200,7 @@ declare class DebugDisplay extends Feature {
3196
3200
  *
3197
3201
  * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
3198
3202
  */
3199
- export declare type Decrement<N extends number> = Tuple<N> extends [unknown, ...infer U] ? U["length"] : never;
3203
+ export declare type Decrement<N extends number> = Arr<N> extends [unknown, ...infer U] ? U["length"] : never;
3200
3204
 
3201
3205
  /**
3202
3206
  * `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
@@ -7548,7 +7552,7 @@ export declare function inCrawlSpace(): boolean;
7548
7552
  *
7549
7553
  * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
7550
7554
  */
7551
- export declare type Increment<N extends number> = [...Tuple<N>, unknown]["length"] & number;
7555
+ export declare type Increment<N extends number> = [...Arr_2<N>, unknown]["length"] & number;
7552
7556
 
7553
7557
  /**
7554
7558
  * Helper function to detect if the current room is one of the rooms in the Death Certificate area.
@@ -16965,11 +16969,12 @@ export declare interface TSTLClassMetatable {
16965
16969
  /**
16966
16970
  * Helper type to represent a tuple of length N.
16967
16971
  *
16968
- * This is used by the `Increment` and `Decrement` helper types.
16969
- *
16970
- * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
16972
+ * From:
16973
+ * https://stackoverflow.com/questions/52489261/typescript-can-i-define-an-n-length-tuple-type/52490977#52490977
16971
16974
  */
16972
- export declare type Tuple<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Tuple<N, [...T, unknown]>;
16975
+ export declare type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
16976
+
16977
+ declare type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
16973
16978
 
16974
16979
  export declare type TupleToIntersection<T extends unknown[]> = T extends [
16975
16980
  infer F,
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 31.2.1
3
+ isaacscript-common 31.2.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -53818,10 +53818,6 @@ return ____exports
53818
53818
  end,
53819
53819
  ["src.types.AllButLast"] = function(...)
53820
53820
  local ____exports = {}
53821
- return ____exports
53822
- end,
53823
- ["src.types.Tuple"] = function(...)
53824
- local ____exports = {}
53825
53821
  return ____exports
53826
53822
  end,
53827
53823
  ["src.types.Decrement"] = function(...)
@@ -53858,6 +53854,10 @@ return ____exports
53858
53854
  end,
53859
53855
  ["src.types.StartsWithUppercase"] = function(...)
53860
53856
  local ____exports = {}
53857
+ return ____exports
53858
+ end,
53859
+ ["src.types.Tuple"] = function(...)
53860
+ local ____exports = {}
53861
53861
  return ____exports
53862
53862
  end,
53863
53863
  ["src.types.TupleToUnion"] = function(...)
@@ -1,8 +1,9 @@
1
- import type { Tuple } from "./Tuple";
2
1
  /**
3
2
  * Helper type to subtract one from a number type.
4
3
  *
5
4
  * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
6
5
  */
7
- export type Decrement<N extends number> = Tuple<N> extends [unknown, ...infer U] ? U["length"] : never;
6
+ export type Decrement<N extends number> = Arr<N> extends [unknown, ...infer U] ? U["length"] : never;
7
+ type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>;
8
+ export {};
8
9
  //# sourceMappingURL=Decrement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Decrement.d.ts","sourceRoot":"","sources":["../../../src/types/Decrement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;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"}
1
+ {"version":3,"file":"Decrement.d.ts","sourceRoot":"","sources":["../../../src/types/Decrement.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,GAC1E,CAAC,CAAC,QAAQ,CAAC,GACX,KAAK,CAAC;AAEV,KAAK,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACxE,CAAC,GACD,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC"}
@@ -1,8 +1,9 @@
1
- import type { Tuple } from "./Tuple";
2
1
  /**
3
2
  * Helper type to add one to a number type.
4
3
  *
5
4
  * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
6
5
  */
7
- export type Increment<N extends number> = [...Tuple<N>, unknown]["length"] & number;
6
+ export type Increment<N extends number> = [...Arr<N>, unknown]["length"] & number;
7
+ type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>;
8
+ export {};
8
9
  //# sourceMappingURL=Increment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Increment.d.ts","sourceRoot":"","sources":["../../../src/types/Increment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GACxE,MAAM,CAAC"}
1
+ {"version":3,"file":"Increment.d.ts","sourceRoot":"","sources":["../../../src/types/Increment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GACtE,MAAM,CAAC;AAET,KAAK,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACxE,CAAC,GACD,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC"}
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Helper type to represent a tuple of length N.
3
3
  *
4
- * This is used by the `Increment` and `Decrement` helper types.
5
- *
6
- * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
4
+ * From:
5
+ * https://stackoverflow.com/questions/52489261/typescript-can-i-define-an-n-length-tuple-type/52490977#52490977
7
6
  */
8
- export type Tuple<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Tuple<N, [...T, unknown]>;
7
+ export type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
8
+ type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
9
+ export {};
9
10
  //# sourceMappingURL=Tuple.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"Tuple.d.ts","sourceRoot":"","sources":["../../../src/types/Tuple.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,GAChD,MAAM,SAAS,CAAC,GACd,CAAC,EAAE,GACH,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GACpB,KAAK,CAAC;AACV,KAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC3E,CAAC,GACD,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "31.2.1",
3
+ "version": "31.2.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,10 +1,12 @@
1
- import type { Tuple } from "./Tuple";
2
-
3
1
  /**
4
2
  * Helper type to subtract one from a number type.
5
3
  *
6
4
  * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
7
5
  */
8
- export type Decrement<N extends number> = Tuple<N> extends [unknown, ...infer U]
6
+ export type Decrement<N extends number> = Arr<N> extends [unknown, ...infer U]
9
7
  ? U["length"]
10
8
  : never;
9
+
10
+ type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N
11
+ ? T
12
+ : Arr<N, [...T, unknown]>;
@@ -1,9 +1,11 @@
1
- import type { Tuple } from "./Tuple";
2
-
3
1
  /**
4
2
  * Helper type to add one to a number type.
5
3
  *
6
4
  * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
7
5
  */
8
- export type Increment<N extends number> = [...Tuple<N>, unknown]["length"] &
6
+ export type Increment<N extends number> = [...Arr<N>, unknown]["length"] &
9
7
  number;
8
+
9
+ type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N
10
+ ? T
11
+ : Arr<N, [...T, unknown]>;
@@ -1,11 +1,14 @@
1
1
  /**
2
2
  * Helper type to represent a tuple of length N.
3
3
  *
4
- * This is used by the `Increment` and `Decrement` helper types.
5
- *
6
- * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
4
+ * From:
5
+ * https://stackoverflow.com/questions/52489261/typescript-can-i-define-an-n-length-tuple-type/52490977#52490977
7
6
  */
8
- export type Tuple<
9
- N extends number,
10
- T extends unknown[] = [],
11
- > = T["length"] extends N ? T : Tuple<N, [...T, unknown]>;
7
+ export type Tuple<T, N extends number> = N extends N
8
+ ? number extends N
9
+ ? T[]
10
+ : _TupleOf<T, N, []>
11
+ : never;
12
+ type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N
13
+ ? R
14
+ : _TupleOf<T, N, [T, ...R]>;