Skip to content

Diagnostics.(param-type-mismatch) #1414

Open
@RomanSpector

Description

@RomanSpector
---@enum Test
local Test = {
    Test1 = 1,
    Test2 = 2,
    Test3 = 2,
}

---@type Test|Test[]
local a

---@param c Test
local function b(c) end

if type(a) == "table" then
    b(a[1]);
else
    b(a);
end

---@class Class
---@field a Test|Test[]
local Class = {};

function Class:Test()
    if type(self.a) == "table" then
        b(self.a[1]);
    else
        b(self.a);
    end
end

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeat/type checkRelated to the type checking feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions