Skip to content

Type checking for functions as argument? #3461

Description

@unlessgames

Is there something I can do have type checking for passed in functions?

---@param fn fun(i: integer)
local function accepts_integer_function(fn)
end

---@type fun(s: string)
local function mismatching_function(s)
end

-- expecting this to raise an error, but it doesn't
accepts_integer_function(mismatching_function)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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