-
-
Notifications
You must be signed in to change notification settings - Fork 351
Way to @type
annotate array of functions without { [integer]: fun() }
#2367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, I randomly come across this issue and after some debugging, I think I have found the cause of this.
And in the code here: lua-language-server/script/vm/compiler.lua Lines 1355 to 1357 in ba8f90e
also here: lua-language-server/script/parser/guide.lua Lines 933 to 957 in ba8f90e
I added the ---@type { [integer]: fun(v: integer) }
local _ = {
[2] = function(v) end, --> v: integer
function(v) end, --> v: integer
}
---@type fun(v: integer)[]
local _ = {
[2] = function(v) end, --> v: any ??? doesn't work
function(v) end, --> v: integer
}
---@type fun(v: integer)[]
local _ = {
[1] = function(v) end, --> v: any ??? doesn't work
[2] = function(v) end, --> v: any ??? doesn't work
}
still maybe you would like to try it out and open PR after testing 😄 @d-enk |
(revisited from #2250 (comment)) I tried to debug into why As explained before, lua-language-server/script/vm/compiler.lua Lines 1492 to 1500 in ba8f90e
So I added I may try to open a PR after more testing when I have time later 😄 |
I wish the last option would work, or at least without
[2]
in{ [integer]: fun() }
The text was updated successfully, but these errors were encountered: