Skip to content

Assign type missmatch nil not cast away #1285

Closed
@Nexela

Description

@Nexela

nil is not cast away when checking with if
image

---@class Entity
---@field direction integer
local ent = {}

---@class Event
---@field start? integer
local event = {}

---@param event Event
local function f(event)
    if event.start then
        ent.direction = event.start
    end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions