Skip to content

Annotation field [string] any prevents to define functions #2171

@NeOzay

Description

@NeOzay

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, Completion

Expected Behaviour

---@field [string] any interfere with function declaration

Actual Behaviour

the types of the fields of the class are not correct: function methode() -> any expected, but get number

Reproduction steps

---@class MyClass
---@field anyField string
---@field [string] number
local MyClass = {
  ---@return any
  methode = function () end
}

MyClass.methode()

image

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions