Skip to content

Incorrect extends result with string and literals or keyof SomeClass #1197

Description

@justarandomgeek
---@class SomeClass
---@field foo boolean

---@type "foo" extends string and true or false
local foostring -- is false, should be true
---@type "bar" extends string and true or false
local barstring -- is false, should be true
---@type "foo" extends keyof SomeClass and true or false
local fookey -- is true, fine
---@type "bar" extends keyof SomeClass and true or false
local barkey -- is false, fine
---@type string extends keyof SomeClass and true or false
local somestring -- is true, should be false; `string` is not a subset of `keyof SomeClass`
---@type keyof SomeClass extends string and true or false
local somekey -- is false, should be true here since all keys of this class are strings, but false for classes with any non-string keys

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