microsoft/TypeScript

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

Opened this issue ยท 0 comments

๐Ÿ”Ž 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