Files

28 lines
994 B
Plaintext

controlFlowDeleteOperator.ts(10,12): error TS2790: The operand of a 'delete' operator must be optional.
controlFlowDeleteOperator.ts(14,12): error TS1102: 'delete' cannot be called on an identifier in strict mode.
controlFlowDeleteOperator.ts(14,12): error TS2703: The operand of a 'delete' operator must be a property reference.
==== controlFlowDeleteOperator.ts (3 errors) ====
function f() {
let x: { a?: number | string, b: number | string } = { b: 1 };
x.a;
x.b;
x.a = 1;
x.b = 1;
x.a;
x.b;
delete x.a;
delete x.b;
~~~
!!! error TS2790: The operand of a 'delete' operator must be optional.
x.a;
x.b;
x;
delete x; // No effect
~
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
~
!!! error TS2703: The operand of a 'delete' operator must be a property reference.
x;
}