isaacscript-common 27.4.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.
@@ -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 between low and high. It is inclusive on the lower end and
12923
- * exclusive on the higher end.
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<NaturalNumbersLessThan<High>, NaturalNumbersLessThan<Low>>;
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;
@@ -15692,13 +15715,13 @@ export declare interface TSTLClassMetatable {
15692
15715
  }
15693
15716
 
15694
15717
  /**
15695
- * Helper type that validates that a tuple does not have a length greater than N - 1.
15718
+ * Helper type to represent a tuple of length N.
15719
+ *
15720
+ * This is used by the `Increment` and `Decrement` helper types.
15696
15721
  *
15697
- * For example, `TupleMaxLength<string, 4>` will allow string tuples of size 0, 1, 2, or 3.
15722
+ * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
15698
15723
  */
15699
- export declare type TupleMaxLength<T, MaxLength extends number> = (T[] | readonly T[]) & {
15700
- length: NaturalNumbersLessThan<MaxLength>;
15701
- };
15724
+ export declare type Tuple<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Tuple<N, [...T, unknown]>;
15702
15725
 
15703
15726
  export declare type TupleToIntersection<T extends unknown[]> = T extends [
15704
15727
  infer F,
@@ -15708,6 +15731,15 @@ infer F,
15708
15731
  /** Helper type to convert a tuple to a union. */
15709
15732
  export declare type TupleToUnion<T extends unknown[]> = T[number];
15710
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
+
15711
15743
  /**
15712
15744
  * This is the number of draw coordinates that each heart spans on the UI in the upper left hand
15713
15745
  * corner.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 27.4.0
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(...)
@@ -52276,11 +52292,11 @@ return ____exports
52276
52292
  local ____exports = {}
52277
52293
  return ____exports
52278
52294
  end,
52279
- ["src.types.TupleMaxLength"] = function(...)
52295
+ ["src.types.TupleToUnion"] = function(...)
52280
52296
  local ____exports = {}
52281
52297
  return ____exports
52282
52298
  end,
52283
- ["src.types.TupleToUnion"] = function(...)
52299
+ ["src.types.TupleWithMaxLength"] = function(...)
52284
52300
  local ____exports = {}
52285
52301
  return ____exports
52286
52302
  end,
@@ -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,9 +174,10 @@ export * from "./types/ReadonlySet";
171
174
  export * from "./types/StartsWithLowercase";
172
175
  export * from "./types/StartsWithUppercase";
173
176
  export * from "./types/TSTLClass";
174
- export * from "./types/TupleMaxLength";
177
+ export * from "./types/Tuple";
175
178
  export * from "./types/TupleToIntersection";
176
179
  export * from "./types/TupleToUnion";
180
+ export * from "./types/TupleWithMaxLength";
177
181
  export * from "./types/UnionToIntersection";
178
182
  export * from "./types/UppercaseKeys";
179
183
  export * from "./types/WeightedArray";
@@ -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,oBAAo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jC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yCAAyC,CAAC;AACxD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,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,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,2 @@
1
+ local ____exports = {}
2
+ return ____exports
@@ -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"}
@@ -0,0 +1,2 @@
1
+ local ____exports = {}
2
+ return ____exports
@@ -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 between low and high. It is inclusive on the lower end and
4
- * exclusive on the higher end.
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<NaturalNumbersLessThan<High>, NaturalNumbersLessThan<Low>>;
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;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,CAAC,GAAG,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,OAAO,CAClE,sBAAsB,CAAC,IAAI,CAAC,EAC5B,sBAAsB,CAAC,GAAG,CAAC,CAC5B,CAAC"}
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,2 @@
1
+ local ____exports = {}
2
+ return ____exports
@@ -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"}
@@ -0,0 +1,2 @@
1
+ local ____exports = {}
2
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "27.4.0",
3
+ "version": "27.5.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
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,9 +174,10 @@ export * from "./types/ReadonlySet";
171
174
  export * from "./types/StartsWithLowercase";
172
175
  export * from "./types/StartsWithUppercase";
173
176
  export * from "./types/TSTLClass";
174
- export * from "./types/TupleMaxLength";
177
+ export * from "./types/Tuple";
175
178
  export * from "./types/TupleToIntersection";
176
179
  export * from "./types/TupleToUnion";
180
+ export * from "./types/TupleWithMaxLength";
177
181
  export * from "./types/UnionToIntersection";
178
182
  export * from "./types/UppercaseKeys";
179
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,8 @@
1
+ import { Tuple } from "./Tuple";
2
+
3
+ /**
4
+ * Helper type to add one to a number type.
5
+ *
6
+ * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
7
+ */
8
+ export type Increment<N extends number> = [...Tuple<N>, unknown]["length"];
@@ -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>>;
@@ -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 between low and high. It is inclusive on the lower end and
5
- * exclusive on the higher end.
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
- NaturalNumbersLessThan<High>,
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
+ };
@@ -1,10 +0,0 @@
1
- import { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
2
- /**
3
- * Helper type that validates that a tuple does not have a length greater than N - 1.
4
- *
5
- * For example, `TupleMaxLength<string, 4>` will allow string tuples of size 0, 1, 2, or 3.
6
- */
7
- export type TupleMaxLength<T, MaxLength extends number> = (T[] | readonly T[]) & {
8
- length: NaturalNumbersLessThan<MaxLength>;
9
- };
10
- //# sourceMappingURL=TupleMaxLength.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TupleMaxLength.d.ts","sourceRoot":"","sources":["../../../src/types/TupleMaxLength.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,SAAS,SAAS,MAAM,IAAI,CACtD,CAAC,EAAE,GACH,SAAS,CAAC,EAAE,CACf,GAAG;IACF,MAAM,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;CAC3C,CAAC"}
@@ -1,13 +0,0 @@
1
- import { NaturalNumbersLessThan } from "./NaturalNumbersLessThan";
2
-
3
- /**
4
- * Helper type that validates that a tuple does not have a length greater than N - 1.
5
- *
6
- * For example, `TupleMaxLength<string, 4>` will allow string tuples of size 0, 1, 2, or 3.
7
- */
8
- export type TupleMaxLength<T, MaxLength extends number> = (
9
- | T[]
10
- | readonly T[]
11
- ) & {
12
- length: NaturalNumbersLessThan<MaxLength>;
13
- };