mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Fix this.member completion+quickinfo of overloads
1. Completion after `this.` was empty. 2. Quick info of methods with overloads always chose the first overload, regardless of whether an argument whose type matched a different overload. Both have the same cause: the type parameter introduced by polymorphic `this` is not usable, whereas the original is. In both cases, the usage is simple -- it doesn't take advantage of the capabilities of polymorphic `this`.
This commit is contained in:
@@ -7977,6 +7977,11 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
// An instance property must be accessed through an instance of the enclosing class
|
||||
if (type.flags & TypeFlags.ThisType) {
|
||||
// get the original type -- represented as the type constraint of the this type
|
||||
type = getConstraintOfTypeParameter(<TypeParameter>type);
|
||||
}
|
||||
|
||||
// TODO: why is the first part of this check here?
|
||||
if (!(getTargetType(type).flags & (TypeFlags.Class | TypeFlags.Interface) && hasBaseType(<InterfaceType>type, enclosingClass))) {
|
||||
error(node, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass));
|
||||
|
||||
@@ -4105,7 +4105,7 @@ namespace ts {
|
||||
let useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.expression.kind === SyntaxKind.SuperKeyword;
|
||||
let allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
|
||||
|
||||
if (!contains(allSignatures, signature.target || signature)) {
|
||||
if (!contains(allSignatures, signature.target) && !contains(allSignatures, signature)) {
|
||||
// Get the first signature if there
|
||||
signature = allSignatures.length ? allSignatures[0] : undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user