isaacscript-common 20.12.1 → 20.12.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.
package/dist/index.d.ts CHANGED
@@ -787,7 +787,7 @@ export declare enum AmbushType {
787
787
  export declare function angleToDirection(angleDegrees: int): Direction;
788
788
 
789
789
  /** Helper type to represent any class. (This is the same type as any class constructor.) */
790
- export declare type AnyClass = new (...args: unknown[]) => unknown;
790
+ export declare type AnyClass = new () => object;
791
791
 
792
792
  /**
793
793
  * A type union that matches `Entity`, `EntityBomb`, `EntityEffect`, and so on.
@@ -6965,7 +6965,9 @@ export declare function initArray<T>(defaultValue: T, size: int): T[];
6965
6965
  * @returns An array of the instantiated features in the same order that the constructors were
6966
6966
  * passed in.
6967
6967
  */
6968
- export declare function initModFeatures(mod: ModUpgraded, modFeatures: Array<typeof ModFeature>): ModFeature[];
6968
+ export declare function initModFeatures<T extends ReadonlyArray<typeof ModFeature>>(mod: ModUpgraded, modFeatures: T): {
6969
+ [Key in keyof T]: InstanceType<T[Key]>;
6970
+ };
6969
6971
 
6970
6972
  /** Helper function to determine if the current room shape is one of the four L room shapes. */
6971
6973
  export declare function inLRoom(): boolean;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.12.1
3
+ isaacscript-common 20.12.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -21,5 +21,7 @@ import { ModUpgraded } from "../types/ModUpgraded";
21
21
  * @returns An array of the instantiated features in the same order that the constructors were
22
22
  * passed in.
23
23
  */
24
- export declare function initModFeatures(mod: ModUpgraded, modFeatures: Array<typeof ModFeature>): ModFeature[];
24
+ export declare function initModFeatures<T extends ReadonlyArray<typeof ModFeature>>(mod: ModUpgraded, modFeatures: T): {
25
+ [Key in keyof T]: InstanceType<T[Key]>;
26
+ };
25
27
  //# sourceMappingURL=modFeatures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modFeatures.d.ts","sourceRoot":"","sources":["../../../src/functions/modFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,KAAK,CAAC,OAAO,UAAU,CAAC,GACpC,UAAU,EAAE,CAYd"}
1
+ {"version":3,"file":"modFeatures.d.ts","sourceRoot":"","sources":["../../../src/functions/modFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,aAAa,CAAC,OAAO,UAAU,CAAC,EACxE,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,CAAC,GACb;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,CAY5C"}
@@ -1,3 +1,3 @@
1
1
  /** Helper type to represent any class. (This is the same type as any class constructor.) */
2
- export type AnyClass = new (...args: unknown[]) => unknown;
2
+ export type AnyClass = new () => object;
3
3
  //# sourceMappingURL=AnyClass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnyClass.d.ts","sourceRoot":"","sources":["../../../src/types/AnyClass.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC"}
1
+ {"version":3,"file":"AnyClass.d.ts","sourceRoot":"","sources":["../../../src/types/AnyClass.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,QAAQ,GAAG,UAAU,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.12.1",
3
+ "version": "20.12.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,10 +22,10 @@ import { ModUpgraded } from "../types/ModUpgraded";
22
22
  * @returns An array of the instantiated features in the same order that the constructors were
23
23
  * passed in.
24
24
  */
25
- export function initModFeatures(
25
+ export function initModFeatures<T extends ReadonlyArray<typeof ModFeature>>(
26
26
  mod: ModUpgraded,
27
- modFeatures: Array<typeof ModFeature>,
28
- ): ModFeature[] {
27
+ modFeatures: T,
28
+ ): { [Key in keyof T]: InstanceType<T[Key]> } {
29
29
  const instantiatedModFeatures: ModFeature[] = [];
30
30
 
31
31
  for (const modFeature of modFeatures) {
@@ -36,5 +36,5 @@ export function initModFeatures(
36
36
  instantiatedModFeatures.push(instantiatedModFeature);
37
37
  }
38
38
 
39
- return instantiatedModFeatures;
39
+ return instantiatedModFeatures as { [Key in keyof T]: InstanceType<T[Key]> };
40
40
  }
@@ -1,2 +1,2 @@
1
1
  /** Helper type to represent any class. (This is the same type as any class constructor.) */
2
- export type AnyClass = new (...args: unknown[]) => unknown;
2
+ export type AnyClass = new () => object;