You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is there a way to specify type aliases for variadic arg functions #3252
changed the title [-]Is there a way to specify type alises for variadic arg functions[/-][+]Is there a way to specify type aliases for variadic arg functions[/+]on Aug 17, 2025
Then it's just not supported currently in LuaLS I believe. 😕
It assumes the ... to be homogeneous (same type), which you can only specific 1 type for it.
If you still would like to use the @alias method, you can define as many arguments as you can.
The annotation for table.unpack is also somewhat done in this way:
Activity
[-]Is there a way to specify type alises for variadic arg functions[/-][+]Is there a way to specify type aliases for variadic arg functions[/+]tomlau10 commentedon Aug 18, 2025
AFAIK, there can only be one type for variadic arg
i.e. if you write
...: A=> it expects all variadic args to be of typeAFor your specific use case which you at most have 4 args, I tested around and you can just write it as:
Although in this case when you hover over
test2, it will be shown as:vaderkos commentedon Aug 25, 2025
My use case rather involved any number of arguments
tomlau10 commentedon Aug 26, 2025
Then it's just not supported currently in LuaLS I believe. 😕
It assumes the
...to be homogeneous (same type), which you can only specific 1 type for it.If you still would like to use the
@aliasmethod, you can define as many arguments as you can.The annotation for
table.unpackis also somewhat done in this way:lua-language-server/meta/template/table.lua
Lines 66 to 85 in 24b9faa
@return ...T(which means all are of the same generic typeT@return T1, T2, xxxto support up to 10 different inferred return value typevaderkos commentedon Aug 30, 2025
Looks like a hack..