Use overload signatures where possible instead of union return types
Posted: Thu Nov 07, 2024 7:49 pm
for example, https://lua-api.factorio.com/latest/cla ... stic_point could trivially be a function with two overloads: fun():LuaLogisticPoint, fun(index):dictionary, and we could in turn generate overload tags for LuaLS to correctly determine which return it got from a given call by the arguments. there are many other functions like this where the return type depends only on the argument types for which function overloads are a *perfect* fit.
This would also help in many cases where the type of later arguments depend on the type (or enum value) of earlier arguments.
This would also help in many cases where the type of later arguments depend on the type (or enum value) of earlier arguments.