justarandomgeek / vscode-factoriomod-debug

Factorio Mod Tool Kit
Other
121 stars 26 forks source link

Request: Provide AnyLuaControlBehavior and other Any for classes with parents, where appropriate #140

Open sparr opened 2 months ago

sparr commented 2 months ago

Most(?) fields and method returns typed as LuaControlBehavior can return any of the child classes, such as LuaConstantCombinatorControlBehavior. Those types should be LuaControlBehavior | LuaConstantCombinatorControlBehavior | etc instead. The relationship between the two types is apparent in the runtime json, as one is the parent of the other.

Based on other examples in the source, this might be implemented as a new alias named AnyLuaControlBehavior. I expect such a change would also apply to some other types with parents, and I thought I had seen a couple while investigating this, but I'm failing to find them right now.

I'd like to work on implementing this, but am posting here first to make sure it's a good/welcome idea, and also to ask for guidance on implementation. Since the two classes are defined in different places (unlike the subclasses handled in #138) it is not clear to me where/how to best approach aggregating the list of child classes of a parent, or where to put the final alias.