#Help with type-checking metatables.
1 messages · Page 1 of 1 (latest)
One way is you first cast it to any then your type
The second way is you use typeof to make your type a metatable as well
Return (module :: any) :: MyType
Or
type MyType = typeof(setmetatable({} :: {[string]: number}, {}))
Or
Another way is to just use --!strict mode and let Roblox workout the type automatically
Danke, much appreciated
All hail Suphi 🙏
I think I just hadd an epiphany, the tostring() for the return type of typeof() is cursed when talking about tables, the return value from typeof is a type object
type K = typeof("Hello")
local Str: K = 0
My example actually has the linter giving me a warning about incompatible types
return (Module :: unknown) :: MyType
unknown also works if for some reason, you have an irrational fear of the word 'any'