Skip to content

Making number and integer classes (partial) #850

@Polanas

Description

@Polanas

I wanted to make a PR for this, but it's probably better to ask first to avoid potential time waste.
Can number and integer classes be made partial? This is really useful for defining methods on numbers.
For example, having a metatable on them with __index containing math functions, one can write

---@class (partial) number
---@field sin fun(self: number): number
--- ...

--evaluates to number
local x = x:sin():abs():round()

instead of

local x = math.round(math.abs(math.sin(x)))

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