Skip to content

Type of self is not inferred correctly when class is located in a table #453

@taminomara

Description

@taminomara

I use tables as namespaces, here's a typical module:

--- @namespace myModule
local ns = {}

--- @class MyClass
ns.MyClass = {}

function ns.MyClass:method()
    -- self is `unknown` here
end

--- @class MyClass2
local MyClass2 = {}

function MyClass2:method()
    -- self is correctly `MyClass2` here
end

return ns

Here, self for ns.MyClass:method is not inferred correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions