Hello! I’ve recently been trying to type-check all of my scripts but have came across an issue of functions supporting tables and Instances…
This is what I have:
type Object = Instance | {[number | string]: Instance}
return {
new = function(Object: Object, Info, Dictionary, AutoPlay, DefaultValues)
if type(Object) == "table" then
local ReturnTable = {}
for Index, NextObject in pairs(Object) do
ReturnTable[Index] = TweenNextObject(NextObject, Info, Dictionary, AutoPlay, DefaultValues)
end
return ReturnTable
else
return TweenNextObject(Object, Info, Dictionary, AutoPlay, DefaultValues)
end
end
}
Where it says for Index, NextObject in pairs(Object) do
, hovering over “Object” says:
"W000: Type 'Instance | {| [number | string]: Instance|}' could not be converted into '{ [number | string]: Instance }'
Is there any way to fix this? I’ve tried looking at all of the Luau syntax and it says nothing about dealing with this behavior. I don’t know if I’m the first person to ever encounter this issue but I highly doubt it. I just don’t know the correct way of searching for such a problem.
The keys I have searched however proven no help. In advance, thanks for the help!