Skip to content

Incorrectly inferred call signatureΒ #60388

Closed as not planned
Closed as not planned
@boris-kolar

Description

@boris-kolar

πŸ”Ž Search Terms

call signature, overloaded call

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about call signature

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.7.0-dev.20241101#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChnIAUAHgFzICMAlOQEz5FnK03IDMuAvrrmAJ4AHFAGE4AGzEBlYAHMQcMAFcoEADwAVAHzIAvMnXIIxSCAAmAZyIA6GwPKgY0ZAAUqu7Q6cAlZAH5rtuSu7sg+5Oq8gigA6lDoIDLqUbrIohLScgrKahjo2gD0+Yx0bjrabEA

πŸ’» Code

interface Foo {
  (x: 1): 2
  (x: 2): 3
}

type CallSignature<T> = T extends (...p: infer P) => infer R ? (...p: P) => R : T
type WrongType = CallSignature<Foo> // (x: 2) => 3

πŸ™ Actual behavior

The inferred type is not compatible with actual type

πŸ™‚ Expected behavior

The inferred type should (at minimum) be compatible with actual type (ideally { (x: 1) => 2; (x: 2) => 3 }).

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions