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
Intellisense for generic parameterized string literal function arguments not working #26662
Observe that once you begin typing the f of string literal foo for the function's second argument, the tooltip switches from suggesting "foo" | "bar" to never:
Good:
Bad:
Also, triggering intellisense with control+space does not suggest foo or bar:
Does this issue occur when all extensions are disabled?: Yes/No
No
The issue here is that mid-call, T really is {} and it really is "correct" to not suggest "Foo"/"Bar" because there are no members of {} with that name. We need to somehow "back out" the inference to typeof myObj and then get its keys instead; probably a nontrivial fix.
Ryan Cavanaugh (@RyanCavanaugh), just to confirm, when you say mid-call, you're referring to once a string '' (quote) token is added for the start of the second argument? I ask because you'll notice in the screenshot from number 3 above, intellisense is correctly suggesting "foo" | "bar". Note that I think that even just adding these two string suggestions that are currently shown in the tooltip to the popout autocomplete list would be a nice improvement.
I think this has been addressed. I'm unable to reproduce the described behavior in the playground using any version of TypeScript available there (the oldest is 3.3).
Activity
mjbvz commentedon Aug 24, 2018
Tested with typescript@3.1.0-dev.20180824 IntelliSense issue still sees to exist
RyanCavanaugh commentedon Aug 24, 2018
The issue here is that mid-call,
Treally is{}and it really is "correct" to not suggest"Foo"/"Bar"because there are no members of{}with that name. We need to somehow "back out" the inference totypeof myObjand then get its keys instead; probably a nontrivial fix.njgraf512 commentedon Aug 24, 2018
Ryan Cavanaugh (@RyanCavanaugh), just to confirm, when you say mid-call, you're referring to once a string
''(quote) token is added for the start of the second argument? I ask because you'll notice in the screenshot from number 3 above, intellisense is correctly suggesting"foo" | "bar". Note that I think that even just adding these two string suggestions that are currently shown in the tooltip to the popout autocomplete list would be a nice improvement.mkantor commentedon Feb 10, 2026
I think this has been addressed. I'm unable to reproduce the described behavior in the playground using any version of TypeScript available there (the oldest is 3.3).