diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 744d23a3657a1..109e30979a94c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3b873cf35c04e..f448f848c05b7 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -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",