Skip to content

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

Closed

Description

@vaderkos
--- @alias Predicate<A> fun(...: A): boolean


local pred = function() end

--[[@cast pred Predicate<string, integer, table>]]





pred('hello', 1, {})
Image

Activity

  1. CppCXY commented on Sep 3, 2025

    @CppCXY
    Member

    Not supported currently.

  2. CppCXY commented on Sep 4, 2025

    @CppCXY
    Member

    now it should support like:

    --- @alias Predicate<A...> fun(...: A...): boolean
    
    
    ---@type Predicate<string, integer, table>
    local pred = function() end
    
    pred('hello', 1, {})
  3. xuhuanzy commented on Sep 30, 2025

    @xuhuanzy
    Member

    I think it's more reasonable to learn the definition of TS.
    I might reimplement the syntax
    If @CppCXY holds an opposing opinion, then the issue will be closed, after all, the syntax has already been implemented.

    --- @alias Predicate1<A> fun(...: A...): boolean
    
    ---@type Predicate1<[string, integer, table]>
    local pred = function() end
    
    pred('hello', 1, {})
    
  4. self-assigned this
    on Sep 30, 2025
  5. added a commit that references this issue on Sep 30, 2025
    da96e32
  6. linked a pull request that will close this issueGenerics #786on Sep 30, 2025
  7. added a commit that references this issue on Sep 30, 2025
    d9e4802
  8. added a commit that references this issue on Oct 9, 2025
    ef7c6c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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