Uh oh!
There was an error while loading. Please reload this page.
Suggest completions for type arguments of expressions - #61758
Suggest completions for type arguments of expressions#61758Matt Kantor (mkantor) wants to merge 1 commit into
Conversation
TypeScript Bot (typescript-bot)
commented
May 23, 2025
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure Daniel Rosenwasser (@DanielRosenwasser) and Ryan Cavanaugh (@RyanCavanaugh) are aware of the changes, just as a heads up. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d01431a to
e4bac38Comparee4bac38 to
04bc7b4CompareAfter some consideration I removed 53d3f29 from this branch, since it's pretty tangential. If there's appetite for it I could submit another pull request. This means @typescript-bot's comment is no longer relevant. |
04bc7b4 to
a3778dcComparePreviously, `getTypeArgumentConstraint` could only find constraints for type arguments of generic type instantiations. Now it additionally supports type arguments of the following expression kinds: - function calls - `new` expressions - tagged templates - JSX expressions - decorators - instantiation expressions
a3778dc to
4bf65ffCompareI got nervous about keeping all of the stacked improvements to myself, so opened #62170 which includes them (along with the changes from this pull request). I'll probably close this one under the assumption that these enhancements are all desirable (if only loosely coupled to one another). |
Matt Kantor (mkantor)
commented
Aug 2, 2025
As mentioned above, see #62170 instead. If you'd prefer that I instead submit each of those commits as a separate pull request (as was my original intention), please let me know. |
Completions are now suggested within type arguments of the following expression types (based on type parameter constraints):
f<…>())newexpressions (new Foo<…>())tag<…>`blah`)<Component<…>/>)@decorator<…> class {})f<…>)Fixes#61751.
Limitations
:in a type argument literal) still don't happen, so No completions fromtsserverfor property values in generic type arguments #56299 should remain open.I might take a stab at this, but it'll be a separate effort from the present changeset.EDIT: I took a stab at this and have something that works, but it's stacked atop this branch so I'll see where this pull request goes before opening another one.getCompletionDataincompletions.ts). This needs fixing to fully address the specific examples in No string completions in type arguments where constrained to string literal union #52898 and No IntelliSense for generic literal types #34771. EDIT: I also have a (stacked) fix for this.This comment may also be useful reading.