Skip to content

Is there a way to specify type aliases for variadic arg functions #3252

@vaderkos

Description

@vaderkos

Is there any way to achieve proper inference of variadic arguments using aliases?

Image

a should be fun(a: table, b: string, c: integer): boolean but instead it's fun(...: table): boolean

I've also tried but it didn't work

--- @alias Predicate1<A> fun(a: A): boolean
--- @alias Predicate2<A, B> fun(a: A, b: B): boolean
--- @alias Predicate3<A, B, C> fun(a: A, b: B, c: C): boolean
--- @alias Predicate4<A, B, C, D> fun(a: A, b: B, c: C, d: D): boolean

--- @alias Predicate<A, B, C, D>
--- | Predicate1<A>
--- | Predicate2<A, B>
--- | Predicate3<A, B, C>
--- | Predicate4<A, B, C, D>

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