Skip to content

Typed field overrides the type of other fields #2711

@halflifefan

Description

@halflifefan

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

local my_class: my_class {
    my_function: function,
    [string]: unknown,
}

Actual Behaviour

local my_class: my_class {
    my_function: function|unknown,
    [string]: unknown,
}

Reproduction steps

---@class my_class
---@field [string] unknown
local my_class = {}

function my_class:my_function() end

Additional Notes

No response

Log File

No response

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