Skip to content

How to type this so Sumneko is happy #1616

Closed Answered by carsakiller
muppet9010 asked this question in Q&A
Discussion options

You must be logged in to vote

If you are going to be assigning random key names that can not be foreseen (and therefor documented with @field), you will have to do the following:

---@type table<string, any>
local x = {
    name = "me",
    nickName = "M"
}

local fieldName = "name"
x[fieldName] = nil

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@muppet9010
Comment options

@carsakiller
Comment options

Answer selected by muppet9010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants