runecapes
(runecapes)
1
Lets say I have a module, that just indexes a module, requires it and returns it
so
--Index.lua
return require(script.ModuleA)
ModuleA has the type ‘TypeA’
I want to access ‘TypeA’ from the Index. Not from having to require the module myself.
But I can’t. Is there no way to do this in LuaU?
1 Like
East98
(East98)
2
You’ll have to re-export types to make them accessible from the root module.
local ModuleA = require(script.ModuleA)
export type TypeA = ModuleA.TypeA
return ModuleA
2 Likes
runecapes
(runecapes)
3
Yeah, I guess this is the only way then.
Damn that sucks.
7z99
(cody)
4
It’s a hack but you can do this, it works for me with the old type solver:
type a = typeof(require(script.ModuleA))
return require(script.ModuleA) :: a
For some reason this doesn’t work even though it’s pretty much the same thing:
return require(script.ModuleA) :: typeof(require(script.ModuleA))
2 Likes
system
(system)
Closed
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.