Skip to content

Incorrect type recursion warning on assert #885

@joshua-cooper

Description

@joshua-cooper

When using assert on an optional recursive type, the language server returns a warning.

For example:

---@alias Value string | Value[]

---@return Value?
function get_value() end

assert(get_value())

Gives me this diagnostic:

expected `(string|Value[])?` but found `(string|Value[])?`. type recursion [param-type-mismatch]

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