@@ -16126,24 +16126,20 @@ namespace ts {
1612616126 function reportUnmatchedProperty(source: Type, target: Type, unmatchedProperty: Symbol, requireOptionalProperties: boolean) {
1612716127 let shouldSkipElaboration = false;
1612816128 // give specific error in case where private names have the same description
16129- if (
16130- unmatchedProperty.valueDeclaration
16129+ if (unmatchedProperty.valueDeclaration
1613116130 && isNamedDeclaration(unmatchedProperty.valueDeclaration)
1613216131 && isPrivateIdentifier(unmatchedProperty.valueDeclaration.name)
16133- && source.symbol.valueDeclaration
16134- && isClassDeclaration(source.symbol.valueDeclaration)
16135- ) {
16132+ && source.symbol.flags & SymbolFlags.Class) {
1613616133 const privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText;
1613716134 const symbolTableKey = getSymbolNameForPrivateIdentifier(source.symbol, privateIdentifierDescription);
1613816135 if (symbolTableKey && getPropertyOfType(source, symbolTableKey)) {
16139- const sourceName = source.symbol.valueDeclaration.name ;
16140- const targetName = target.symbol.valueDeclaration && isClassDeclaration (target.symbol.valueDeclaration) ? target.symbol.valueDeclaration.name : undefined ;
16136+ const sourceName = getDeclarationName( source.symbol.valueDeclaration) ;
16137+ const targetName = getDeclarationName (target.symbol.valueDeclaration);
1614116138 reportError(
1614216139 Diagnostics.Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2,
1614316140 diagnosticName(privateIdentifierDescription),
16144- diagnosticName(sourceName || anon),
16145- diagnosticName(targetName || anon),
16146- );
16141+ diagnosticName(sourceName.escapedText === "" ? anon : sourceName),
16142+ diagnosticName(targetName.escapedText === "" ? anon : targetName));
1614716143 return;
1614816144 }
1614916145 }
0 commit comments