isaacscript-common 39.4.1 → 39.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "39.4.1",
3
+ "version": "39.4.3",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,6 +25,6 @@
25
25
  "main": "dist/src/index",
26
26
  "types": "dist/index.rollup.d.ts",
27
27
  "dependencies": {
28
- "isaac-typescript-definitions": "^17.0.2"
28
+ "isaac-typescript-definitions": "^17.0.3"
29
29
  }
30
30
  }
@@ -20,7 +20,7 @@ export class InputActionFilter extends CustomCallback<T> {
20
20
  fireArgs: FireArgs<T>,
21
21
  optionalArgs: OptionalArgs<T>,
22
22
  ): boolean => {
23
- const [_, inputHook, buttonAction] = fireArgs;
23
+ const [_entity, inputHook, buttonAction] = fireArgs;
24
24
  const [callbackInputHook, callbackButtonAction] = optionalArgs;
25
25
 
26
26
  return (
@@ -75,8 +75,19 @@ export abstract class CustomCallback<
75
75
  const { callbackFunc, optionalArgs } = subscription;
76
76
 
77
77
  if (this.shouldFire(fireArgs, optionalArgs)) {
78
- // TypeScript is not smart enough to know that the arguments match the function.
79
- const value = (callbackFunc as AnyFunction)(...fireArgs);
78
+ // - TypeScript is not smart enough to know that the arguments match the function, so we
79
+ // must cast it to `AnyFunction`.
80
+ // - We cannot use `...fireArgs` here because it would fail to pass any arguments that exist
81
+ // beyond `nil` elements.
82
+ const value = (callbackFunc as AnyFunction)(
83
+ fireArgs[0],
84
+ fireArgs[1],
85
+ fireArgs[2],
86
+ fireArgs[3],
87
+ fireArgs[4],
88
+ fireArgs[5],
89
+ fireArgs[6],
90
+ );
80
91
  if (value !== undefined) {
81
92
  return value as ReturnType<AddCallbackParametersCustom[T][0]>;
82
93
  }