isaacscript-common 39.4.2 → 39.4.4

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.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 39.4.2
3
+ isaacscript-common 39.4.4
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -18335,7 +18335,6 @@ return ____exports
18335
18335
  local ____lualib = require("lualib_bundle")
18336
18336
  local __TS__Class = ____lualib.__TS__Class
18337
18337
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
18338
- local __TS__Spread = ____lualib.__TS__Spread
18339
18338
  local __TS__ArrayFindIndex = ____lualib.__TS__ArrayFindIndex
18340
18339
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
18341
18340
  local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
@@ -18365,7 +18364,13 @@ function CustomCallback.prototype.____constructor(self, ...)
18365
18364
  if self:shouldFire(fireArgs, optionalArgs) then
18366
18365
  local value = callbackFunc(
18367
18366
  nil,
18368
- __TS__Spread(fireArgs)
18367
+ fireArgs[1],
18368
+ fireArgs[2],
18369
+ fireArgs[3],
18370
+ fireArgs[4],
18371
+ fireArgs[5],
18372
+ fireArgs[6],
18373
+ fireArgs[7]
18369
18374
  )
18370
18375
  if value ~= nil then
18371
18376
  return value
@@ -18495,7 +18500,7 @@ __TS__ClassExtends(InputActionFilter, CustomCallback)
18495
18500
  function InputActionFilter.prototype.____constructor(self)
18496
18501
  CustomCallback.prototype.____constructor(self)
18497
18502
  self.shouldFire = function(____, fireArgs, optionalArgs)
18498
- local _, inputHook, buttonAction = table.unpack(fireArgs)
18503
+ local _entity, inputHook, buttonAction = table.unpack(fireArgs)
18499
18504
  local callbackInputHook, callbackButtonAction = table.unpack(optionalArgs)
18500
18505
  return (callbackInputHook == nil or callbackInputHook == inputHook) and (callbackButtonAction == nil or callbackButtonAction == buttonAction)
18501
18506
  end
@@ -13,7 +13,7 @@ __TS__ClassExtends(InputActionFilter, CustomCallback)
13
13
  function InputActionFilter.prototype.____constructor(self)
14
14
  CustomCallback.prototype.____constructor(self)
15
15
  self.shouldFire = function(____, fireArgs, optionalArgs)
16
- local _, inputHook, buttonAction = table.unpack(fireArgs)
16
+ local _entity, inputHook, buttonAction = table.unpack(fireArgs)
17
17
  local callbackInputHook, callbackButtonAction = table.unpack(optionalArgs)
18
18
  return (callbackInputHook == nil or callbackInputHook == inputHook) and (callbackButtonAction == nil or callbackButtonAction == buttonAction)
19
19
  end
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCallback.d.ts","sourceRoot":"","sources":["../../../../src/classes/private/CustomCallback.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,iBAAiB,IAAI,UAAU,CAC5D,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAAI,WAAW,CACjE,2BAA2B,CAAC,CAAC,CAAC,CAC/B,CAAC;AAQF;;;GAGG;AACH,8BAAsB,cAAc,CAClC,CAAC,SAAS,iBAAiB,CAC3B,SAAQ,OAAO;IACf,OAAO,CAAC,aAAa,CAA8B;IAE5C,aAAa,CAClB,QAAQ,EAAE,gBAAgB,GAAG,GAAG,EAChC,YAAY,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/C,GAAG,YAAY,EAAE,WAAW,CAAC,2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2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/C,GAAG,YAAY,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,GAC3D,IAAI;IAiBP;;;OAGG;IACI,gBAAgB,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAYnE,IAAI,gBACI,SAAS,CAAC,CAAC,KACvB,WAAW,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAyB9C;IAEF;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,CACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,KAC1B,OAAO,CAAc;IAEnB,gBAAgB,IAAI,IAAI;CAYhC"}
@@ -1,7 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__Class = ____lualib.__TS__Class
3
3
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
- local __TS__Spread = ____lualib.__TS__Spread
5
4
  local __TS__ArrayFindIndex = ____lualib.__TS__ArrayFindIndex
6
5
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
7
6
  local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
@@ -33,7 +32,13 @@ function CustomCallback.prototype.____constructor(self, ...)
33
32
  if self:shouldFire(fireArgs, optionalArgs) then
34
33
  local value = callbackFunc(
35
34
  nil,
36
- __TS__Spread(fireArgs)
35
+ fireArgs[1],
36
+ fireArgs[2],
37
+ fireArgs[3],
38
+ fireArgs[4],
39
+ fireArgs[5],
40
+ fireArgs[6],
41
+ fireArgs[7]
37
42
  )
38
43
  if value ~= nil then
39
44
  return value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "39.4.2",
3
+ "version": "39.4.4",
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.3"
28
+ "isaac-typescript-definitions": "^17.0.4"
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
  }