Skip to content

Commit ae8d546

Browse files
committed
exclude mention about constant from error message 'a-constant-or-a-read-only-property' to be more specific.
1 parent 28fc0a2 commit ae8d546

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9339,7 +9339,7 @@ namespace ts {
93399339
if (accessExpression) {
93409340
markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === SyntaxKind.ThisKeyword);
93419341
if (isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
9342-
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop));
9342+
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
93439343
return missingType;
93449344
}
93459345
if (cacheSymbol) {
@@ -15895,7 +15895,7 @@ namespace ts {
1589515895
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
1589615896
}
1589715897
else {
15898-
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol));
15898+
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
1589915899
}
1590015900
return errorType;
1590115901
}
@@ -18468,7 +18468,7 @@ namespace ts {
1846818468
checkPropertyAccessibility(node, left.kind === SyntaxKind.SuperKeyword, apparentType, prop);
1846918469
if (assignmentKind) {
1847018470
if (isReferenceToReadonlyEntity(<Expression>node, prop) || isReferenceThroughNamespaceImport(<Expression>node)) {
18471-
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, idText(right));
18471+
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
1847218472
return errorType;
1847318473
}
1847418474
}

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,7 @@
19441944
"category": "Error",
19451945
"code": 2539
19461946
},
1947-
"Cannot assign to '{0}' because it is a constant or a read-only property.": {
1947+
"Cannot assign to '{0}' because it is a read-only property.": {
19481948
"category": "Error",
19491949
"code": 2540
19501950
},

0 commit comments

Comments
 (0)