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:
interface Foo {
apple: string;
banana: number;
cherry: boolean;
}
interface SomeGeneric<F extends Foo> {
foo: F;
}
I was kind of expecting to be given some hints about what keys I needed when writing this:
declare const s: SomeGeneric<{
apple: "hey";
banana: 123;
// <-- no IntelliSense here for anything but "readonly"
}>;
Instead, I only seem to get a suggestion for readonly. It would be very helpful if apple, banana, and cherry 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:
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, andcherrywere 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: