Requiring a module returns *unknown* type

Alright, so I’m making a new UI Library called Lito. I was just getting ready to wrap up with Luau type support, however now that I’ve done that, for some odd reason require() just decides when and when it doesn’t want to return the module. I got it working at some point, changed one character and it went back to *unknown*. Even tried reverting the change, however it still persisted.

This is what I mean:

Using --!strict does work, however it introduces a bunch of warnings inside the script and I don’t want to be editing with a solid yellow line on the side and warnings to pass by every so often.

I’m going bald because of this, so please someone with a solution come out and reach out to me.

Does the ModuleScript actually return anything? If it does then all I can suggest is that you explicitly infer Lito's type.

Can you show us any of the source code… Maybe specifics relating to the return statement?

As for me, I checked out my little library since I had the time.

This example also works when I move it to ReplicatedStorage. So not sure what’s up with your module not working.

Yes, it returns module. It’s proven to work in the current state it’s in due to the fact that it’s worked previously, just the moment something is changed, it just decides when to not work.

The module Lito is closed-source, as it’s for a private cause. However I can show you how it’s structured.

Beginning module definition

It returning the module variable

Printing the module (or return result of require()) correctly prints everything out, from the beginning variables initiated at the top, to the function.

Absolutely no errors or discrepancies. I’ve even removed all Luau exclusive syntaxes in another copy of the script and even in this copy it’s freaking out.

I’ve come on today to see what it would say now, and it actually now says <error-type>, so that’s fun.

Apologies, I had to rename some of my Luau types, because now that I have it’s returning module. Appreciate the help albeit if it wasnt notable due to no source code.