Skip to content

Completions for type arguments of expressions #61751

@mkantor

Description

@mkantor
Contributor

πŸ” Search Terms

generic, function, class, call, apply, construct, "type parameter", "type argument", completion, suggestion, autocomplete, intellisense

βœ… Viability Checklist

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
    This wouldn't change the runtime behavior of existing JavaScript code
    This could be implemented without emitting different JS based on the types of the expressions
    This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
    This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
    This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

⭐ Suggestion

#43526 implemented completions within type arguments of generic types. It would be nice to extend that behavior to the expression level, suggesting completions within type arguments of generic function calls, new expressions, etc.

πŸ“ƒ Motivating Example

In this code, foo is suggested:

type A<T extends { foo: unknown }> = T
type _ = A<{/* trigger completions here */}>

(Playground)

In this code it's not:

function f<T extends { foo: unknown }>() {}
f<{/* trigger completions here */}>()

(Playground)

Related Issues

Activity

mkantor

mkantor commented on May 22, 2025

@mkantor
ContributorAuthor

I've started working on this already, but couldn't find an open issue about it so figured I ought to file one.

added
Possible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases
on Jun 5, 2025
added this to the Backlog milestone on Jun 5, 2025
mkantor

mkantor commented on Jul 3, 2025

@mkantor
ContributorAuthor

@RyanCavanaugh sorry for the direct mention, but since you tagged this as "help wanted", did you miss the pull request I'd opened?

I have some other completion enhancements that I'm eager to submit, but they're based on the changes in that pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedYou can do thisPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @mkantor@RyanCavanaugh

      Issue actions

        Completions for type arguments of expressions Β· Issue #61751 Β· microsoft/TypeScript