I’m currently making a strict type checked script but can’t find a way to type annotate a variable that requires a Module Script without using the type any
which is bad practice.
DoSomethingScript
:
--!strict
local moduleScript: any = script.SomethingModule -- How do I change the any type here?
moduleScript:DoSomething()
moduleScript:NotMethodAndShouldRaiseWarning() -- Using the any type doesn't give warnings for non-existant methods
SomethingModule
:
local SomethingModule = {}
function SomethingModule.DoSomething()
print("Doing something")
end
return SomethingModule
I tried looking at the Roblox Creator Hub documentation and Luau website for how to type annotate a Module Script but can’t find anything about it.
So how would I define the type for a Module Script?