table.insert warning? #1631
Unanswered
Rouneq
asked this question in
General Questions
Replies: 2 comments 1 reply
|
I don't think there's an easy way to change ---@generic T
---@param arr T[]
---@param value T
local function my_insert(arr, value)
table.insert(arr, value)
endbut unfortunately it looks like the language server doesn't check generic parameter types. :( You can always open an issue to get that implemented if no one else has better ideas. |
1 reply
|
I know the It is defined as: table.insert(table, position, value)But of course, the following is also valid, but never narrowed down to: table.insert(table, value)I know better narrowing of functions has been talked about in various places, so that will hopefully be fixed. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
If I have a setup like so:
Is there a way to get the language server to warn me about the non-conforming value?
I also tried defining a class with all the appropriate fields and typing
valuesto that class.All reactions