You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Typescript Autocompletion Not Working For Function Overloads #26892
OS Version: Linux version 4.15.0-32-generic Ubuntu
Steps to Reproduce:
I provided a small example of the issue (see screenshot below).
Create a function with two overloads
Try to invoke this function
Once you typed in the first parameter, the IDE recognizes that it matches the first overload's signature.
However, the auto-completion suggest the literals for both overloads.
I expect the auto-completion to show "BW" and "BY" only!
Does this issue occur when all extensions are disabled?: Yes
The auto-compete does work on the instances with P instances, but does NOT work when calling the P[] or FunctionField<T> (typechecking does still work, but it's very hard to remember these key names)
Ryan Cavanaugh (@RyanCavanaugh) I'd like to help with this, as fixing it would enable a library API design that isn't really viable right now, while autocomplete is suggesting invalid candidates. However, I've never contributed to the language server before and don't know how it's set up. Do you have any sense of how hard this would be? And, if not too bad, any pointers on how to get started?
Activity
ChuckJonas commentedon Nov 8, 2018
I'm also having an issue with autocomplete on overloaded code:
The auto-compete does work on the instances with
Pinstances, but does NOT work when calling theP[]orFunctionField<T>(typechecking does still work, but it's very hard to remember these key names)Kingwl commentedon Dec 28, 2018
What is the expected behavior?
implement a partial signature resolve or fill parameters with correct type?
fuafa commentedon Feb 18, 2019
The signature help is wrong either if the first argument is
Austria, the signature help still shows the first overload.jueinin commentedon Nov 18, 2020
any updates on this? I have a function with 100+ overloads. needs this feature very much!
Kingwl commentedon Nov 18, 2020
Good luck....
jueinin commentedon Nov 18, 2020
Wenlu Wang (@Kingwl)
sad...
I write 100+ overloads in one go
and finally, i find that the autocomplete has been totally destroyed.
dani-ras commentedon Oct 6, 2022
Is there any update on this?
I just tried using an overloaded function and found the autocomplete is not narrowing after providing partial argument..
ethanresnick commentedon May 18, 2023
Ryan Cavanaugh (@RyanCavanaugh) I'd like to help with this, as fixing it would enable a library API design that isn't really viable right now, while autocomplete is suggesting invalid candidates. However, I've never contributed to the language server before and don't know how it's set up. Do you have any sense of how hard this would be? And, if not too bad, any pointers on how to get started?
dwjohnston commentedon Oct 9, 2024
Here is another simple example of this behaviour:
We can get the autocomplete behaviour back by converting to a generic:
But as a rule of thumb, I prefer to use function overloads over generics - tends to be simpler.