Inferring modules from ObjectValues

I made a post about this in Development Discussion and I’ve been redirected here.
This is a feature request.

If you require a module from an ObjectValue’s Value property, the module’s type doesn’t
get inferred. I understand that ObjectValue’s can be used dynamically, but even when the Value of the ObjectValue is set before the run-time, the type still won’t get inferred. Other instances WILL get their types inferred in such case. Why are modules not given that functionality?

This makes scripting in a !strict mode very inconvenient, especially when you are relying on types from the modules being required.

In my case, I use ObjectValues to abstract the hierarchy of things I need to access, and be able to reduce module duplication. I think this feature would make it just a little easier to deal with.

Thats about it.

Edit: Requiring a module directly (no object value abstraction):


Requiring a module through an object value (With the Value statically defined):

Do keep in mind, the ModuleScript type itself does get inferred from the Value. What I’m having a problem with is the requiring of the module and the type returned by the module not being inferred. I should have made that clearer in my first message, my bad.

1 Like