Skip to content

Inference breaks when a function returns a tuple with another function #44476

Open

Description

Bug Report

🔎 Search Terms

Inference, tuple, generic, callback, higher-order function

🕗 Version & Regression Information

v4.3.2 and below (tested down to v3.3.3)

⏯ Playground Link

Playground link with relevant code

💻 Code

declare function a(): [
  <T>(arg: T) => T
]

declare function b<T, U>(a1: T, a2: [(a: T) => U]): U

b(1, [a()[0]]) // returns number, as expected
b(1, a()) // returns unknown (expected a number)

Activity

  1. RyanCavanaugh commented on Jun 8, 2021

    @RyanCavanaugh
    Member

    Looks like there's an incorrect inference priority being assigned here

  2. added
    Domain: check: Type Inference
    on Oct 16, 2025
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

    BugDomain: check: Type Inference

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions