Over the past couple days, I have been rewriting the entirety of the game I develop. One of the changes to the codebase makes it use new Luau features, one of these being strict type checking.
I have repeatedly run into issues where my types are dubbed “too complex” to validate, which causes all analysis on the type and anything that uses that type to completely fail.
Unfortunately, splitting these types or simplifying them is not an option for my use case. When I make these types, they are a union between the module’s declaration and an instance created by that module.
local MyModule = {}
MyModule.__index = MyModule
type MyModule = typeof(MyModule) & {
SomeInstanceProperty: number,
-- ...
}
return MyModule
This allows autocomplete to browse all of its methods and properties together for an instance of my type. Unfortunately, the primary type that my game is centered around is extremely massive (the static module type has ~130 method declarations, and ~100 total instance member declarations, some nested more than others). Each of these methods has some signature associated with them, many returning some of the subtypes of this major type. To add to the pile, the companion to this module is a class extending it, so on top of that ~230 members, it adds its own ~200 members (about a third of them are overrides, the rest are not).
This limit has been problematic for my work, because I rely on autocomplete and intellisense to help me work with my code. When it is stopped from working, not only am I unable to work with that script as easily, but anything that uses that script has its autocomplete rendered completely useless.
Edit: An alternative would be to expose this limit in Studio’s preferences.