mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #5169 from Microsoft/fix-simple-uses-of-polymorphic-this-in-services
Fix simple uses of polymorphic this in services
This commit is contained in:
@@ -7984,6 +7984,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));
|
||||
|
||||
Reference in New Issue
Block a user