Skip to content

[Feature Request] Generic Operators #1729

@eigenbom

Description

@eigenbom

I'd like to be able to define overloads of an operator, for example a matrix class could provide the following overloads of mul:

---@class mat4
---@operator mul(mat4): mat4 -- matrix mult
---@operator mul(vec3): vec3 -- matrix * vector
---@operator mul(number): mat4 -- matrix * constant

However it seems that local y = matrix * vector; is currently deduced as type mat4 | vec3.

Is there a way to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions