Completion list should include property names of constraining type when writing object type literals in type argument positions #33302
Labels
Domain: Completion Lists
The issue relates to showing completion lists in an editor
Effort: Moderate
Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".
Experience Enhancement
Noncontroversial enhancements
Fixed
A PR has been merged for this issue
Help Wanted
You can do this
Rescheduled
This issue was previously scheduled to an earlier milestone
Suggestion
An idea for TypeScript
Milestone
Search Terms
completion list, IntelliSense, keys, members, generic constraint,
Suggestion with Example
It would be nice to get some IntelliSense help when specifying the members of a constrained object type. For example, given these types:
I was kind of expecting to be given some hints about what keys I needed when writing this:
Instead, I only seem to get a suggestion for
readonly
. It would be very helpful ifapple
,banana
, andcherry
were part of the completion list.Use Cases
I would think this is useful anytime you're specifying a constrained generic parameter, or possibly even extending an existing interface. Its absence is painful in any case where the generic type has lots of members, as in this Stack Overflow question.
Related Issues
Possibly related to #1506?
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: