-
-
Notifications
You must be signed in to change notification settings - Fork 331
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
Ipairs with generic #2969
Comments
seems there are
More observations on the
The current workaround I found for this ---@class Test
---@field name string
---@type Test[]
local tests = {}
---@generic V
---@param rows V[]
---@param key string
---@return {[string]: V[]}
local function group_by(rows, key) end
local groups = group_by(tests, "name")
--> groups: { [string]: Test[] } |
As a temporary solution for second issue, it stopped things from getting worse. 🥰
Although the types are still weird, it works anyway! 😇 |
I think it is better to split into 2 issues 🤔 since the |
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Annotations
Expected Behaviour
Should have got a correct type inference in a generic function.
Actual Behaviour
V
-related type forresult
in the generic functionipairs
will be inferred asunknown
Reproduction steps
Additional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered: