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

Defining types #1479

Closed
RomanSpector opened this issue Aug 18, 2022 · 0 comments
Closed

Defining types #1479

RomanSpector opened this issue Aug 18, 2022 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@RomanSpector
Copy link

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?

Type Checking

Expected Behaviour

image

image

Actual Behaviour

image

image

Reproduction steps

---@alias Test
---| "Test1"
---| "Test2"
---| "Test3"

---@class Car
---@field a number
---@field b number
local Car = {};

---@return boolean
function Car:c() end

---@type table<Test, fun(car: Car): boolean>
local CONDITIONS =
{
    ["Test1"] = function(car) return car:c() end,
    ["Test2"] = function(car) return car:c() end,
    ["Test3"] = function(car) return car:c() end,
}

local conditions = CONDITIONS["Test1"];

Additional Notes

No response

Log File

No response

@sumneko sumneko added the enhancement New feature or request label Aug 20, 2022
@sumneko sumneko added this to the 3.6.0 milestone Sep 19, 2022
@sumneko sumneko closed this as completed in 167a17c Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants