Skip to content

Commit

Permalink
fix microsoft#11480, disallow delete operator on readonly property or…
Browse files Browse the repository at this point in the history
… index

signature
  • Loading branch information
HerringtonDarkholme committed Nov 2, 2016
1 parent 6b94bae commit 7f25eb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13486,6 +13486,9 @@ namespace ts {

function checkDeleteExpression(node: DeleteExpression): Type {
checkExpression(node.expression);
checkReferenceExpression(node.expression,
Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference,
Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
return booleanType;
}

Expand Down
8 changes: 8 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,14 @@
"category": "Error",
"code": 2697
},
"The operand of a delete operator must be a property reference": {
"category": "Error",
"code": 2698
},
"The operand of a delete operator cannot be a read-only property": {
"category": "Error",
"code": 2699
},

"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
Expand Down

0 comments on commit 7f25eb6

Please sign in to comment.