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

Typed field overrides the type of other fields #2711

Open
halflifefan opened this issue Jun 15, 2024 · 1 comment
Open

Typed field overrides the type of other fields #2711

halflifefan opened this issue Jun 15, 2024 · 1 comment

Comments

@halflifefan
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

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

@halflifefan halflifefan changed the title Typed field overrides the type of other fields. Typed field overrides the type of other fields Jun 15, 2024
@halflifefan
Copy link
Author

Workaround: create a base class with typed fields.

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

1 participant