@@ -16126,24 +16126,20 @@ namespace ts {
16126
16126
function reportUnmatchedProperty(source: Type, target: Type, unmatchedProperty: Symbol, requireOptionalProperties: boolean) {
16127
16127
let shouldSkipElaboration = false;
16128
16128
// give specific error in case where private names have the same description
16129
- if (
16130
- unmatchedProperty.valueDeclaration
16129
+ if (unmatchedProperty.valueDeclaration
16131
16130
&& isNamedDeclaration(unmatchedProperty.valueDeclaration)
16132
16131
&& isPrivateIdentifier(unmatchedProperty.valueDeclaration.name)
16133
- && source.symbol.valueDeclaration
16134
- && isClassDeclaration(source.symbol.valueDeclaration)
16135
- ) {
16132
+ && source.symbol.flags & SymbolFlags.Class) {
16136
16133
const privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText;
16137
16134
const symbolTableKey = getSymbolNameForPrivateIdentifier(source.symbol, privateIdentifierDescription);
16138
16135
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);
16141
16138
reportError(
16142
16139
Diagnostics.Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2,
16143
16140
diagnosticName(privateIdentifierDescription),
16144
- diagnosticName(sourceName || anon),
16145
- diagnosticName(targetName || anon),
16146
- );
16141
+ diagnosticName(sourceName.escapedText === "" ? anon : sourceName),
16142
+ diagnosticName(targetName.escapedText === "" ? anon : targetName));
16147
16143
return;
16148
16144
}
16149
16145
}
0 commit comments