Skip to content

alias 包含nil时的bug #860

Closed
Closed

Description

@iamhaiwen

---@alias PersonAge
---| integer
---| nil

---@Class Person
---@field name string
---@field age PersonAge

---@type Person
local person = {
name = "123",
}

Activity

  1. iamhaiwen commented on Nov 22, 2025

    @iamhaiwen
    Author

    这个算不算BUG,我在初始化person时给age赋值nil也没问题。

  2. CppCXY commented on Nov 25, 2025

    @CppCXY
    Member

    不改的叫feature, 最好还是显式使用可空, 我们很多阶段都不会直接展开alias, 通常是为了避免无限递归

  3. self-assigned this
    on Jun 20, 2026
  4. added theissue type on Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions