Hello forum,
recently, I started learning and experimenting with type checking and lua oop overall. Yesterday I stumbled upon a problem, which I still haven’t found a solution for.
The probliem lies within this code snippet. The :Fire method to be exact. Its an experimental “connetion?” system similar to the one you use normally for built in roblox events.
--!strict
local Signal = {}
Signal.__index = Signal
function Signal:Fire(...) -- problem
if #self.callbacks == 0 then return end -- guard clause here: read later
for index, listener in self.callbacks do -- self.callbacks is a table of functions
if type(listener) == "function" then -- refining listener to type function
coroutine.wrap(listener)(...) -- ISSUE! warning: "cannot call a value of type unknown". But listener refined to type "function"???
end
end
end
Maybe you read by the comments in the code, but there is a warning at coroutine.wrap(listener)(...). This makes no sense to me, because the type of listener is refined to “function”
!! IMPORTANT NOTE: this warning disappears when removing the guard clause if #self.callbacks == 0 then return end
Im just trying to shut up the compiler with my crappy code and any help will be appreciated ![]()

