mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Mark references to dynamically-named properties as used (#21010)
* Mark references to dynamically-named properties as used * Avoid showing the symbol ID * Use symbolToString instead of showSymbol
This commit is contained in:
@@ -8252,6 +8252,7 @@ namespace ts {
|
||||
const prop = getPropertyOfType(objectType, propName);
|
||||
if (prop) {
|
||||
if (accessExpression) {
|
||||
markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === SyntaxKind.ThisKeyword);
|
||||
if (isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
|
||||
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop));
|
||||
return unknownType;
|
||||
@@ -21356,8 +21357,9 @@ namespace ts {
|
||||
// Already would have reported an error on the getter.
|
||||
break;
|
||||
}
|
||||
if (!member.symbol.isReferenced && hasModifier(member, ModifierFlags.Private)) {
|
||||
error(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(member.symbol));
|
||||
const symbol = getSymbolOfNode(member);
|
||||
if (!symbol.isReferenced && hasModifier(member, ModifierFlags.Private)) {
|
||||
error(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol));
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Constructor:
|
||||
|
||||
Reference in New Issue
Block a user