Skip to content

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

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

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

    BugA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolution

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions