Skip to content

Enhance type argument completions #62170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mkantor
Copy link
Contributor

@mkantor mkantor commented Aug 1, 2025

#43526 implemented limited support for completions within type arguments, but only for type arguments of types (not values like generic function calls), and only for specific locations within the type literal (e.g. property names of object types). This pull request generalizes type argument completions such that suggestions now appear in many more scenarios, including:

  • Type arguments of expressions:
    • function calls (f<…>())
    • new expressions (new Foo<…>())
    • tagged templates (tag<…>`blah`)
    • JSX elements (<Component<…>/>)
    • decorators (@decorator<…> class {})
    • instantiation expressions (f<…>)
  • Types of property values within type arguments (Foo<{ x: … }>)
  • String literal types (Foo<"…">)
  • Tuple types (Foo<[…]>)

Suggested completions are derived from the relevant type parameter's constraint.

This pull request subsumes #61758 and includes the additional enhancements mentioned in that pull request's description.

Fixes #61751.
Fixes #56299.
Fixes #52898.
Fixes #34771.

mkantor added 2 commits August 1, 2025 07:33
Previously, `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
@i-ayushh18
Copy link

🤖 AI Assistant: Task completed: PR #62170: Enhance type argument completions

URL: #6217...

1 similar comment
@i-ayushh18
Copy link

🤖 AI Assistant: Task completed: PR #62170: Enhance type argument completions

URL: #6217...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants