Skip to content

Intellisense displays function props instead of object's in generic function overloadΒ #62693

@kinderswan

Description

@kinderswan

πŸ”Ž Search Terms

function, overload, overloading, overload order, generic functions, intellisense

πŸ•— Version & Regression Information

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

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.9.3&ssl=22&ssc=3&pln=1&pc=1#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXwygGcBrAHgBUA+ACgFsoSQAueGgSngF4r4L3WANxxZgAKFCRYCFOmx4CxctRqwA5qwDeDJqw7deFAL4D4w0WLGFSNTWPgB6B-GBYiAB2gBPIkjSZcfCxUDBAYVCgIIjETSwlwaDg-OUDFUgAmSlp1LR0WNk4ePhMhEXFJRJl-eXxrEkyVPL1Cw1NzcSsldNt7Jxc3TygfeDz4YnhUEBBQcVjLCulkgIU6gGZ6Rnz9IqhULzay+Kkk2WXapXWc+G1N5oMxvZKzQ87SdbtHZ1cPb19R8cm02mMXYQA

πŸ’» Code

declare function task<T>(make: () => T): void
declare function task<T>(arg: {make: () => T}): void

task({
 // displays function internals
})


declare function task2<T>(arg: {make: () => T}): void
declare function task2<T>(make: () => T): void

task2({
 // displays make as needed
})


declare function task3(make: () => any): void
declare function task3(arg: {make: () => any}): void

task3({
 // displays make as needed
})

πŸ™ Actual behavior

Intellisense displays the function internals, like bind, call, apply instead of displaying the property of the object passed
Image

It depends on the order how the overloads are provided. If I change them and put the object first - it displays the object props as needed

Without generic parameter it also works as needed

πŸ™‚ Expected behavior

The order of function overloads doesn't matter and doesn't affect intellisense suggestions

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: LS: Completion ListsThe issue relates to showing completion lists in an editor

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions