Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use @enum or @alias type in table index (index signature) #2791

Open
tmillr opened this issue Aug 11, 2024 · 4 comments
Open

Unable to use @enum or @alias type in table index (index signature) #2791

tmillr opened this issue Aug 11, 2024 · 4 comments

Comments

@tmillr
Copy link
Contributor

tmillr commented Aug 11, 2024

I don't know if this is intended or not, but IIRC this is possible in typescript.

---@enum idx
local enum = { a = 'a', b = 'b' }

---@param tbl table<idx, string>
local function x(tbl) end

When calling x with a table (e.g. x({ | })), I expect to receive completion for a and b, but I don't get that.

@tmillr tmillr changed the title Unable to use @enum type in table index Unable to use @enum type in table index (index signature) Aug 11, 2024
@tmillr
Copy link
Contributor Author

tmillr commented Aug 11, 2024

Surprisingly, it doesn't work with @alias either -_-.

I guess @alias doesn't actually create an "alias".

@tmillr tmillr changed the title Unable to use @enum type in table index (index signature) Unable to use @enum or @alias type in table index (index signature) Aug 12, 2024
@tomlau10
Copy link
Contributor

Some similar issues:

@wiredmatt
Copy link

This used to work perfectly fine, what broke it? I remember using this december last year with no issue at all. Is it the LSP or VS Code?

@tmillr
Copy link
Contributor Author

tmillr commented Oct 5, 2024

Is it the LSP or VS Code?

LSP. I don't use vscode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants