diff options
-rw-r--r-- | script/core/noder.lua | 3 | ||||
-rw-r--r-- | test/type_inference/init.lua | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 1e502339..2a60baee 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -887,7 +887,8 @@ local function compileCallParam(noders, call, sourceID) local eventNodeID for firstIndex, callArg in ipairs(call.args) do firstIndex = firstIndex - fixIndex - if firstIndex == 1 and callArg.type == 'string' then + if (firstIndex == 1 or firstIndex == 2) + and callArg.type == 'string' then if callArg[1] then eventNodeID = sformat('%s%s%s' , nodeID diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index ef2d1f62..7316730e 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -941,6 +941,17 @@ emit:on("died", function (<?i?>) end) ]] +TEST 'integer' [[ +--- @class Emit +--- @field on fun(self: Emit, eventName: string, cb: function) +--- @field on fun(self: Emit, eventName: '"died"', cb: fun(i: integer)) +--- @field on fun(self: Emit, eventName: '"won"', cb: fun(s: string)) +local emit = {} + +emit.on(self, "died", function (<?i?>) +end) +]] + TEST '👍' [[ ---@class 👍 local <?x?> |