Script editor should be able to access module type when using a table require path

Reproduction Steps

  1. Create a new ModuleScript and a new Script

  2. In your script, have a setup like this:





  1. Notice that there’s no type inference, even though there should be.

Expected Behavior

You should be able to see the type of data returned when requiring a module through a dictionary or array.

Actual Behavior

When using a table require path, you get the following result:


The only workaround is to not use table require paths, which in my workflow is heavily undesired. Intellisense speeds up my work and should apply to all types of paths, as long as it ends in a module script.

Not sure if this is a bug or intended behavior, but if it should be fixed straight away no matter what.

Issue Area: Studio
Issue Type: Other
Impact: High
Frequency: Constantly

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!


Just going to ping @WheretIB as it looks like they might respond to this.

It’s unlikely that this is going to be fixed any time soon.

Module require dependencies are solved before typechecking is performed.

This is similar how C++ #include dependencies are found without compiling C++ or Rust modules are looked up.
Rust does have macros to get some flexibility on module references, but it’s like a second language on top.

Not saying that Luau should be bad like C++ or Rust, but for context on how these complications come in when dealing with dependencies.

We have some ideas on resolving requires that are resolved late during the type solve, but it’s tricky with how you have to interrupt active module typecheck to check one or more other modules.


How does require work internally? I have this set up like this: `Table.Packages :: typeof(script.Parent.Packages)

In my opinion, it doesn’t make too much sense that even if a specific type is defined this does not work.

AST fragment inside require() is walked while matching names to the DataModel children and handling a few special functions along the way.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.