It is a common thing where I will want to declare an array like this:
{ “Hello”, 3 }
This is unfortunately not a valid type, and also cannot be specified as a type. table.pack cannot be used as a work-around here as well because it masks the types as soon as you have a multi-type array
This creates a pretty big headache for many use cases as certain things actually require this behavior in the Roblox API.
A way that the types could be specified are as follows:
{ any } doesn’t work either (when nullable, which is what we need in our project) which is why we made this post. Seems like it’s the same bug you just mentioned though.
--!strict
local function foo(x: {any}?)
end
foo({42, "Hello"}) --> errors
We’ve gotten used to typing certain function calls as: