mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 06:17:19 -05:00
This reverts commit 1b8c68d746.
This commit is contained in:
committed by
GitHub
parent
468ca9f870
commit
6a6c83cf9a
@@ -27682,12 +27682,23 @@ namespace ts {
|
||||
}
|
||||
const links = getNodeLinks(expr);
|
||||
const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
|
||||
if (symbol && isReadonlySymbol(symbol)) {
|
||||
error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
||||
if (symbol) {
|
||||
if (isReadonlySymbol(symbol)) {
|
||||
error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
||||
}
|
||||
|
||||
checkDeleteExpressionMustBeOptional(expr, getTypeOfSymbol(symbol));
|
||||
}
|
||||
return booleanType;
|
||||
}
|
||||
|
||||
function checkDeleteExpressionMustBeOptional(expr: AccessExpression, type: Type) {
|
||||
const AnyOrUnknownOrNeverFlags = TypeFlags.AnyOrUnknown | TypeFlags.Never;
|
||||
if (strictNullChecks && !(type.flags & AnyOrUnknownOrNeverFlags) && !(getFalsyFlags(type) & TypeFlags.Undefined)) {
|
||||
error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
||||
}
|
||||
}
|
||||
|
||||
function checkTypeOfExpression(node: TypeOfExpression): Type {
|
||||
checkExpression(node.expression);
|
||||
return typeofType;
|
||||
|
||||
@@ -2963,6 +2963,10 @@
|
||||
"category": "Error",
|
||||
"code": 2789
|
||||
},
|
||||
"The operand of a 'delete' operator must be optional.": {
|
||||
"category": "Error",
|
||||
"code": 2790
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
Reference in New Issue
Block a user