Skip to content

mismatching object literal type doesn't raise linting error #1434

@xiangnanscu

Description

@xiangnanscu

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows WSL

What is the issue affecting?

Type Checking

Expected Behaviour

should show linting error

Actual Behaviour

doesn't show error

Reproduction steps

---@param opts {a:number, b:number}
local function foo(opts)

end

---@param opts {c:number, d:number}
local function bar(opts)
  foo(opts)  -- this should raise linting error
end

considering the ts equivalent:

function foo(opts:{a:number,b:number}) {

}
function bar(opts:{c:number,d:number}) {
  foo(opts)
}

Additional Notes

No response

Log File

No response

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions