Injecting Module Scripts With Intellisense

Let’s say I have ModuleA:

local moduleA = {}

function moduleA:init(moduleB)
	self.moduleB = moduleB
end

function moduleA:doSomething()
	local moduleB = self.moduleB
	moduleB. -- no intellisense
end

return moduleA

ModuleA is being injected with moduleB within its initialize method, the issue is when I try to access moduleB after it’s been added to moduleA, it doesn’t show me anything about moduleB as if it doesn’t exists.

is there a way to pass modules to other modules while allowing for intellisense?
I looked this up and I’m speculating that it has to do with type annotations but I’m sure if it’s the case here?

1 Like