Skip to content

Support generic table #3042

@ibachar

Description

@ibachar

Hi,

Is it possible to create a generic table such that the returned type is the key as a type. For example:

---@class MyClass
local MyClass = {}

---@generic T
---@type table<'T', T>
local Classes = {}

local c = Classes["MyClass"]

In the above example, I expect c to have the type MyClass

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