Merge pull request #28313 from a-tarasyuk/feature/28297-make-error-message-at--a-constant-or-a-read-only-property--more-specific

Feature/28297 make error message at  a constant or a read only property  more specific
This commit is contained in:
Daniel Rosenwasser
2018-11-13 11:42:13 -08:00
committed by GitHub
39 changed files with 329 additions and 320 deletions
+8 -3
View File
@@ -9455,7 +9455,7 @@ namespace ts {
if (accessExpression) {
markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === SyntaxKind.ThisKeyword);
if (isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop));
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
return missingType;
}
if (cacheSymbol) {
@@ -16115,7 +16115,12 @@ namespace ts {
return errorType;
}
if (isReadonlySymbol(localOrExportSymbol)) {
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol));
if (localOrExportSymbol.flags & SymbolFlags.Variable) {
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
}
else {
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
}
return errorType;
}
}
@@ -18700,7 +18705,7 @@ namespace ts {
checkPropertyAccessibility(node, left.kind === SyntaxKind.SuperKeyword, apparentType, prop);
if (assignmentKind) {
if (isReferenceToReadonlyEntity(<Expression>node, prop) || isReferenceThroughNamespaceImport(<Expression>node)) {
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, idText(right));
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
return errorType;
}
}
+5 -1
View File
@@ -1944,7 +1944,7 @@
"category": "Error",
"code": 2539
},
"Cannot assign to '{0}' because it is a constant or a read-only property.": {
"Cannot assign to '{0}' because it is a read-only property.": {
"category": "Error",
"code": 2540
},
@@ -2124,6 +2124,10 @@
"category": "Error",
"code": 2587
},
"Cannot assign to '{0}' because it is a constant.": {
"category": "Error",
"code": 2588
},
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
"code": 2600
@@ -6,7 +6,7 @@ tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstra
tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'readonlyProp' from class 'B'.
tests/cases/compiler/abstractPropertyNegative.ts(15,5): error TS1244: Abstract methods can only appear within an abstract class.
tests/cases/compiler/abstractPropertyNegative.ts(16,37): error TS1005: '{' expected.
tests/cases/compiler/abstractPropertyNegative.ts(19,3): error TS2540: Cannot assign to 'ro' because it is a constant or a read-only property.
tests/cases/compiler/abstractPropertyNegative.ts(19,3): error TS2540: Cannot assign to 'ro' because it is a read-only property.
tests/cases/compiler/abstractPropertyNegative.ts(25,5): error TS2416: Property 'num' in type 'WrongTypePropertyImpl' is not assignable to the same property in base type 'WrongTypeProperty'.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/abstractPropertyNegative.ts(31,9): error TS2416: Property 'num' in type 'WrongTypeAccessorImpl' is not assignable to the same property in base type 'WrongTypeAccessor'.
@@ -56,7 +56,7 @@ tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors
let c = new C();
c.ro = "error: lhs of assignment can't be readonly";
~~
!!! error TS2540: Cannot assign to 'ro' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'ro' because it is a read-only property.
abstract class WrongTypeProperty {
abstract num: number;
@@ -1,7 +1,7 @@
tests/cases/compiler/assignToEnum.ts(2,1): error TS2539: Cannot assign to 'A' because it is not a variable.
tests/cases/compiler/assignToEnum.ts(3,1): error TS2539: Cannot assign to 'A' because it is not a variable.
tests/cases/compiler/assignToEnum.ts(4,3): error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property.
tests/cases/compiler/assignToEnum.ts(5,3): error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property.
tests/cases/compiler/assignToEnum.ts(4,3): error TS2540: Cannot assign to 'foo' because it is a read-only property.
tests/cases/compiler/assignToEnum.ts(5,3): error TS2540: Cannot assign to 'foo' because it is a read-only property.
==== tests/cases/compiler/assignToEnum.ts (4 errors) ====
@@ -14,9 +14,9 @@ tests/cases/compiler/assignToEnum.ts(5,3): error TS2540: Cannot assign to 'foo'
!!! error TS2539: Cannot assign to 'A' because it is not a variable.
A.foo = 1; // invalid LHS
~~~
!!! error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'foo' because it is a read-only property.
A.foo = A.bar; // invalid LHS
~~~
!!! error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'foo' because it is a read-only property.
@@ -1,7 +1,7 @@
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(11,1): error TS2708: Cannot use namespace 'M' as a value.
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(14,1): error TS2539: Cannot assign to 'C' because it is not a variable.
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(17,1): error TS2539: Cannot assign to 'E' because it is not a variable.
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,3): error TS2540: Cannot assign to 'A' because it is a read-only property.
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(21,1): error TS2539: Cannot assign to 'fn' because it is not a variable.
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): error TS2693: 'I' only refers to a type, but is being used as a value here.
@@ -32,7 +32,7 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): er
!!! error TS2539: Cannot assign to 'E' because it is not a variable.
E.A = null; // OK per spec, Error per implementation (509581)
~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'A' because it is a read-only property.
function fn() { }
fn = null; // Should be error
@@ -1,10 +1,10 @@
tests/cases/compiler/bigintWithLib.ts(4,1): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/bigintWithLib.ts(16,33): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a constant or a read-only property.
tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
tests/cases/compiler/bigintWithLib.ts(28,35): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a constant or a read-only property.
tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'.
tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'.
@@ -37,7 +37,7 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
let len: number = bigIntArray.length;
bigIntArray.length = 10; // should error
~~~~~~
!!! error TS2540: Cannot assign to 'length' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'length' because it is a read-only property.
let arrayBufferLike: ArrayBufferView = bigIntArray;
// Test BigUint64Array
@@ -54,7 +54,7 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
len = bigIntArray.length;
bigIntArray.length = 10; // should error
~~~~~~
!!! error TS2540: Cannot assign to 'length' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'length' because it is a read-only property.
arrayBufferLike = bigIntArray;
// Test added DataView methods
@@ -1,10 +1,10 @@
tests/cases/conformance/jsdoc/validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(19,1): error TS2322: Type '"no"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(20,1): error TS2322: Type '"no"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '0' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(39,1): error TS2322: Type '0' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/validator.ts(40,1): error TS2322: Type '"no"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not assignable to type 'string'.
@@ -29,10 +29,10 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not
// disallowed assignments
m1.readonlyProp = "name";
~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
m1.readonlyAccessor = 12;
~~~~~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
m1.thing = "no";
~~~~~~~~
!!! error TS2322: Type '"no"' is not assignable to type 'number'.
@@ -59,10 +59,10 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not
// disallowed assignments
m2.readonlyProp = "name";
~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
m2.readonlyAccessor = 12;
~~~~~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
m2.thing = 0;
~~~~~~~~
!!! error TS2322: Type '0' is not assignable to type 'string'.
@@ -1,5 +1,5 @@
tests/cases/conformance/jsdoc/validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '"no"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(22,1): error TS2322: Type '"no"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not assignable to type 'string'.
@@ -26,10 +26,10 @@ tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not
// disallowed assignments
m1.readonlyProp = "name";
~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
m1.readonlyAccessor = 12;
~~~~~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
m1.thing = "no";
~~~~~~~~
!!! error TS2322: Type '"no"' is not assignable to type 'number'.
@@ -1,7 +1,7 @@
tests/cases/conformance/jsdoc/validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property.
tests/cases/conformance/jsdoc/validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property.
tests/cases/conformance/jsdoc/validate.ts(16,1): error TS2322: Type '12' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property.
==== tests/cases/conformance/jsdoc/validate.ts (4 errors) ====
@@ -20,16 +20,16 @@ tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to
x.lastName = "should fail";
~~~~~~~~
!!! error TS2540: Cannot assign to 'lastName' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property.
x.houseNumber = 12; // should also fail
~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'houseNumber' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property.
x.zipStr = 12; // should fail
~~~~~~~~
!!! error TS2322: Type '12' is not assignable to type 'string'.
x.middleInit = "R"; // should also fail
~~~~~~~~~~
!!! error TS2540: Cannot assign to 'middleInit' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property.
==== tests/cases/conformance/jsdoc/index.js (0 errors) ====
const x = {};
@@ -2,9 +2,9 @@ tests/cases/conformance/jsdoc/importer.js(3,5): error TS2339: Property 'other' d
tests/cases/conformance/jsdoc/importer.js(4,5): error TS2339: Property 'prop' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'.
tests/cases/conformance/jsdoc/importer.js(11,5): error TS2339: Property 'other' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'.
tests/cases/conformance/jsdoc/importer.js(12,5): error TS2339: Property 'prop' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'.
tests/cases/conformance/jsdoc/importer.js(13,5): error TS2540: Cannot assign to 'bad1' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/importer.js(14,5): error TS2540: Cannot assign to 'bad2' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/importer.js(15,5): error TS2540: Cannot assign to 'bad3' because it is a constant or a read-only property.
tests/cases/conformance/jsdoc/importer.js(13,5): error TS2540: Cannot assign to 'bad1' because it is a read-only property.
tests/cases/conformance/jsdoc/importer.js(14,5): error TS2540: Cannot assign to 'bad2' because it is a read-only property.
tests/cases/conformance/jsdoc/importer.js(15,5): error TS2540: Cannot assign to 'bad3' because it is a read-only property.
==== tests/cases/conformance/jsdoc/importer.js (7 errors) ====
@@ -30,13 +30,13 @@ tests/cases/conformance/jsdoc/importer.js(15,5): error TS2540: Cannot assign to
!!! error TS2339: Property 'prop' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'.
mod.bad1 = 0;
~~~~
!!! error TS2540: Cannot assign to 'bad1' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'bad1' because it is a read-only property.
mod.bad2 = 0;
~~~~
!!! error TS2540: Cannot assign to 'bad2' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'bad2' because it is a read-only property.
mod.bad3 = 0;
~~~~
!!! error TS2540: Cannot assign to 'bad3' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'bad3' because it is a read-only property.
==== tests/cases/conformance/jsdoc/mod1.js (0 errors) ====
const obj = { value: 42, writable: true };
@@ -31,9 +31,9 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(116,5): error TS2
Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(117,5): error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
Type 'keyof T' is not assignable to type 'never'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a read-only property.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(135,5): error TS2542: Index signature in type 'DeepReadonlyArray<Part>' only permits reading.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a read-only property.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(137,10): error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject<Part>'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2322: Type 'ZeroOf<T>' is not assignable to type 'T'.
Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'.
@@ -231,13 +231,13 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
let id: number = part.subparts[0].id;
part.id = part.id; // Error
~~
!!! error TS2540: Cannot assign to 'id' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'id' because it is a read-only property.
part.subparts[0] = part.subparts[0]; // Error
~~~~~~~~~~~~~~~~
!!! error TS2542: Index signature in type 'DeepReadonlyArray<Part>' only permits reading.
part.subparts[0].id = part.subparts[0].id; // Error
~~
!!! error TS2540: Cannot assign to 'id' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'id' because it is a read-only property.
part.updatePart("hello"); // Error
~~~~~~~~~~
!!! error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject<Part>'.
@@ -1,4 +1,4 @@
tests/cases/compiler/file2.ts(1,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/file2.ts(1,1): error TS2588: Cannot assign to 'x' because it is a constant.
==== tests/cases/compiler/file1.ts (0 errors) ====
@@ -7,4 +7,4 @@ tests/cases/compiler/file2.ts(1,1): error TS2540: Cannot assign to 'x' because i
==== tests/cases/compiler/file2.ts (1 errors) ====
x++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
@@ -1,20 +1,20 @@
tests/cases/compiler/constDeclarations-access2.ts(4,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(5,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(6,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(7,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(8,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(9,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(10,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(11,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(12,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(13,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(14,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(15,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(17,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(18,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(19,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(20,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(22,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access2.ts(4,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(5,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(6,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(7,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(8,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(9,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(10,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(11,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(12,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(13,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(14,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(15,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(17,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(18,1): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(19,3): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(20,3): error TS2588: Cannot assign to 'x' because it is a constant.
tests/cases/compiler/constDeclarations-access2.ts(22,5): error TS2588: Cannot assign to 'x' because it is a constant.
==== tests/cases/compiler/constDeclarations-access2.ts (17 errors) ====
@@ -23,57 +23,57 @@ tests/cases/compiler/constDeclarations-access2.ts(22,5): error TS2540: Cannot as
// Errors
x = 1;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x += 2;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x -= 3;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x *= 4;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x /= 5;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x %= 6;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x <<= 7;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x >>= 8;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x >>>= 9;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x &= 10;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x |= 11;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x ^= 12;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
x--;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
++x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
--x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
++((x));
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
// OK
var a = x + 1;
@@ -1,21 +1,21 @@
tests/cases/compiler/constDeclarations-access3.ts(6,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(7,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(8,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(9,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(10,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(11,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(12,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(13,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(14,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(15,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(16,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(17,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(19,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(20,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(21,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(22,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(24,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(6,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(7,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(8,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(9,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(10,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(11,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(12,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(13,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(14,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(15,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(16,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(17,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(19,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(20,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(21,5): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(22,5): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(24,7): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
==== tests/cases/compiler/constDeclarations-access3.ts (18 errors) ====
@@ -26,61 +26,61 @@ tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2540: Cannot as
// Errors
M.x = 1;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x += 2;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x -= 3;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x *= 4;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x /= 5;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x %= 6;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x <<= 7;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x >>= 8;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x >>>= 9;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x &= 10;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x |= 11;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x ^= 12;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x--;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
++M.x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
--M.x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
++((M.x));
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M["x"] = 0;
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
// OK
var a = M.x + 1;
@@ -1,21 +1,21 @@
tests/cases/compiler/constDeclarations-access4.ts(6,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(7,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(8,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(9,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(10,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(11,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(12,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(13,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(14,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(15,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(16,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(17,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(19,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(20,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(21,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(22,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(24,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(6,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(7,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(8,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(9,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(10,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(11,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(12,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(13,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(14,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(15,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(16,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(17,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(19,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(20,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(21,5): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(22,5): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(24,7): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
==== tests/cases/compiler/constDeclarations-access4.ts (18 errors) ====
@@ -26,61 +26,61 @@ tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2540: Cannot as
// Errors
M.x = 1;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x += 2;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x -= 3;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x *= 4;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x /= 5;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x %= 6;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x <<= 7;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x >>= 8;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x >>>= 9;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x &= 10;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x |= 11;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x ^= 12;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M.x--;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
++M.x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
--M.x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
++((M.x));
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
M["x"] = 0;
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
// OK
var a = M.x + 1;
@@ -1,21 +1,21 @@
tests/cases/compiler/constDeclarations_access_2.ts(4,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(5,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(6,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(7,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(8,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(9,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(10,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(11,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(12,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(13,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(14,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(15,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(17,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(18,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(19,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(20,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(22,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(24,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(4,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(5,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(6,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(7,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(8,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(9,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(10,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(11,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(12,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(13,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(14,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(15,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(17,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(18,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(19,5): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(20,5): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(22,7): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(24,3): error TS2540: Cannot assign to 'x' because it is a read-only property.
==== tests/cases/compiler/constDeclarations_access_2.ts (18 errors) ====
@@ -24,61 +24,61 @@ tests/cases/compiler/constDeclarations_access_2.ts(24,3): error TS2540: Cannot a
// Errors
m.x = 1;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x += 2;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x -= 3;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x *= 4;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x /= 5;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x %= 6;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x <<= 7;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x >>= 8;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x >>>= 9;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x &= 10;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x |= 11;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x ^= 12;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m
m.x++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m.x--;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
++m.x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
--m.x;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
++((m.x));
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
m["x"] = 0;
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
// OK
var a = m.x + 1;
@@ -4,7 +4,7 @@ tests/cases/compiler/constDeclarations-errors.ts(4,7): error TS1155: 'const' dec
tests/cases/compiler/constDeclarations-errors.ts(4,11): error TS1155: 'const' declarations must be initialized.
tests/cases/compiler/constDeclarations-errors.ts(4,15): error TS1155: 'const' declarations must be initialized.
tests/cases/compiler/constDeclarations-errors.ts(4,27): error TS1155: 'const' declarations must be initialized.
tests/cases/compiler/constDeclarations-errors.ts(9,27): error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-errors.ts(9,27): error TS2588: Cannot assign to 'c8' because it is a constant.
tests/cases/compiler/constDeclarations-errors.ts(12,11): error TS1155: 'const' declarations must be initialized.
tests/cases/compiler/constDeclarations-errors.ts(15,20): error TS1155: 'const' declarations must be initialized.
@@ -32,7 +32,7 @@ tests/cases/compiler/constDeclarations-errors.ts(15,20): error TS1155: 'const' d
// error, assigning to a const
for(const c8 = 0; c8 < 1; c8++) { }
~~
!!! error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'c8' because it is a constant.
// error, can not be unintalized
for(const c9; c9 < 1;) { }
@@ -1,7 +1,7 @@
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(13,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query.
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(14,12): error TS2476: A const enum member can only be accessed using a string literal.
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(16,1): error TS2322: Type '"string"' is not assignable to type 'G'.
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS2540: Cannot assign to 'B' because it is a read-only property.
==== tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts (4 errors) ====
@@ -30,5 +30,5 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS25
function foo(x: G) { }
G.B = 3;
~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'B' because it is a read-only property.
@@ -1,4 +1,4 @@
tests/cases/compiler/constWithNonNull.ts(4,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constWithNonNull.ts(4,1): error TS2588: Cannot assign to 'x' because it is a constant.
==== tests/cases/compiler/constWithNonNull.ts (1 errors) ====
@@ -7,5 +7,5 @@ tests/cases/compiler/constWithNonNull.ts(4,1): error TS2540: Cannot assign to 'x
declare const x: number | undefined;
x!++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'x' because it is a constant.
@@ -1,6 +1,6 @@
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'A' because it is a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'A' because it is a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'A' because it is a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2542: Index signature in type 'typeof ENUM1' only permits reading.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,7): error TS2304: Cannot find name 'A'.
@@ -14,15 +14,15 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp
// expression
var ResultIsNumber1 = --ENUM1["A"];
~~~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'A' because it is a read-only property.
var ResultIsNumber2 = ENUM1.A--;
~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'A' because it is a read-only property.
// miss assignment operator
--ENUM1["A"];
~~~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'A' because it is a read-only property.
ENUM1[A]--;
~~~~~~~~
@@ -1,5 +1,5 @@
tests/cases/conformance/salsa/enums.js(2,10): error TS2540: Cannot assign to 'DESC' because it is a constant or a read-only property.
tests/cases/conformance/salsa/enums.js(3,10): error TS2540: Cannot assign to 'ASC' because it is a constant or a read-only property.
tests/cases/conformance/salsa/enums.js(2,10): error TS2540: Cannot assign to 'DESC' because it is a read-only property.
tests/cases/conformance/salsa/enums.js(3,10): error TS2540: Cannot assign to 'ASC' because it is a read-only property.
==== tests/cases/conformance/salsa/lovefield-ts.d.ts (0 errors) ====
@@ -12,8 +12,8 @@ tests/cases/conformance/salsa/enums.js(3,10): error TS2540: Cannot assign to 'AS
lf.Order = {}
lf.Order.DESC = 0;
~~~~
!!! error TS2540: Cannot assign to 'DESC' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'DESC' because it is a read-only property.
lf.Order.ASC = 1;
~~~
!!! error TS2540: Cannot assign to 'ASC' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'ASC' because it is a read-only property.
@@ -1,23 +1,23 @@
tests/cases/compiler/f2.ts(6,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(7,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(6,7): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(7,7): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(8,7): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
tests/cases/compiler/f2.ts(11,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(12,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(16,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(17,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(11,7): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(12,7): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(16,8): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(17,8): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(18,8): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
tests/cases/compiler/f2.ts(21,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(22,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(26,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(27,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(28,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(29,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(21,8): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(22,8): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(26,12): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(27,12): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(28,12): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(29,12): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(30,12): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
tests/cases/compiler/f2.ts(31,12): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
tests/cases/compiler/f2.ts(35,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(36,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(37,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(38,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(35,13): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(36,13): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(37,13): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(38,13): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/compiler/f2.ts(39,13): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
@@ -33,10 +33,10 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist
stuff.x = 0;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
stuff['x'] = 1;
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
stuff.blah = 2;
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
@@ -44,19 +44,19 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist
stuff.x++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
stuff['x']++;
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
stuff['blah']++;
stuff[n]++;
(stuff.x) = 0;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
(stuff['x']) = 1;
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
(stuff.blah) = 2;
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
@@ -64,25 +64,25 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist
(stuff.x)++;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
(stuff['x'])++;
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
(stuff['blah'])++;
(stuff[n])++;
for (stuff.x in []) {}
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for (stuff.x of []) {}
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for (stuff['x'] in []) {}
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for (stuff['x'] of []) {}
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for (stuff.blah in []) {}
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
@@ -94,16 +94,16 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist
for ((stuff.x) in []) {}
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for ((stuff.x) of []) {}
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for ((stuff['x']) in []) {}
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for ((stuff['x']) of []) {}
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
for ((stuff.blah) in []) {}
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'.
+2 -2
View File
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/for-ofStatements/for-of2.ts(1,7): error TS1155: 'const' declarations must be initialized.
tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2540: Cannot assign to 'v' because it is a constant or a read-only property.
tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2588: Cannot assign to 'v' because it is a constant.
==== tests/cases/conformance/es6/for-ofStatements/for-of2.ts (2 errors) ====
@@ -8,4 +8,4 @@ tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2540: Cann
!!! error TS1155: 'const' declarations must be initialized.
for (v of []) { }
~
!!! error TS2540: Cannot assign to 'v' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'v' because it is a constant.
@@ -1,7 +1,7 @@
tests/cases/conformance/externalModules/b.ts(6,1): error TS2539: Cannot assign to 'x' because it is not a variable.
tests/cases/conformance/externalModules/b.ts(7,1): error TS2539: Cannot assign to 'y' because it is not a variable.
tests/cases/conformance/externalModules/b.ts(8,4): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/conformance/externalModules/b.ts(9,4): error TS2540: Cannot assign to 'y' because it is a constant or a read-only property.
tests/cases/conformance/externalModules/b.ts(8,4): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/conformance/externalModules/b.ts(9,4): error TS2540: Cannot assign to 'y' because it is a read-only property.
==== tests/cases/conformance/externalModules/b.ts (4 errors) ====
@@ -18,10 +18,10 @@ tests/cases/conformance/externalModules/b.ts(9,4): error TS2540: Cannot assign t
!!! error TS2539: Cannot assign to 'y' because it is not a variable.
a1.x = 1; // Error
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
a1.y = 1; // Error
~
!!! error TS2540: Cannot assign to 'y' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'y' because it is a read-only property.
a2.x = 1;
a2.y = 1;
a3.x = 1;
@@ -1,7 +1,7 @@
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,7): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'B' because it is a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'B' because it is a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'B' because it is a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,7): error TS2540: Cannot assign to 'B' because it is a read-only property.
==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts (4 errors) ====
@@ -12,16 +12,16 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp
// expression
var ResultIsNumber1 = ++ENUM1["B"];
~~~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'B' because it is a read-only property.
var ResultIsNumber2 = ENUM1.B++;
~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'B' because it is a read-only property.
// miss assignment operator
++ENUM1["B"];
~~~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'B' because it is a read-only property.
ENUM1.B++;
~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'B' because it is a read-only property.
@@ -1,8 +1,8 @@
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(25,15): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(25,15): error TS2540: Cannot assign to 'value' because it is a read-only property.
==== tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts (5 errors) ====
@@ -24,21 +24,21 @@ tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(25,15): e
let base: Base;
base.value = 12 // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let identical: Base & Identical;
identical.value = 12; // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let mutable: Base & Mutable;
mutable.value = 12; // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let differentType: Base & DifferentType;
differentType.value = 12; // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let differentName: Base & DifferentName;
differentName.value = 12; // error, property 'value' doesn't exist
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
@@ -1,5 +1,5 @@
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(4,1): error TS2539: Cannot assign to 'E' because it is not a variable.
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(5,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(5,3): error TS2540: Cannot assign to 'A' because it is a read-only property.
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(9,1): error TS2539: Cannot assign to 'C' because it is not a variable.
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(14,1): error TS2693: 'I' only refers to a type, but is being used as a value here.
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(17,1): error TS2539: Cannot assign to 'M' because it is not a variable.
@@ -15,7 +15,7 @@ tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.t
!!! error TS2539: Cannot assign to 'E' because it is not a variable.
E.A = x;
~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'A' because it is a read-only property.
class C { foo: string }
var f: C;
@@ -15,9 +15,9 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(92,1): error TS2741: Proper
tests/cases/conformance/types/mapped/mappedTypes6.ts(104,1): error TS2739: Type '{ a: number; }' is missing the following properties from type 'Required<Foo>': b, c, d
tests/cases/conformance/types/mapped/mappedTypes6.ts(105,1): error TS2739: Type '{ a: number; b: number; }' is missing the following properties from type 'Required<Foo>': c, d
tests/cases/conformance/types/mapped/mappedTypes6.ts(106,1): error TS2741: Property 'd' is missing in type '{ a: number; b: number; c: number; }' but required in type 'Required<Foo>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(116,4): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
tests/cases/conformance/types/mapped/mappedTypes6.ts(119,4): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
tests/cases/conformance/types/mapped/mappedTypes6.ts(116,4): error TS2540: Cannot assign to 'b' because it is a read-only property.
tests/cases/conformance/types/mapped/mappedTypes6.ts(119,4): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Cannot assign to 'b' because it is a read-only property.
==== tests/cases/conformance/types/mapped/mappedTypes6.ts (19 errors) ====
@@ -173,15 +173,15 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno
x3.a = 1;
x3.b = 1; // Error
~
!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
declare let x4: Readonly<Bar>;
x4.a = 1; // Error
~
!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
x4.b = 1; // Error
~
!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
declare let x5: Readwrite<Bar>;
x5.a = 1;
@@ -1,6 +1,6 @@
tests/cases/compiler/objectFreeze.ts(9,1): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/compiler/objectFreeze.ts(9,1): error TS2542: Index signature in type 'ReadonlyArray<number>' only permits reading.
tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' because it is a read-only property.
==== tests/cases/compiler/objectFreeze.ts (3 errors) ====
@@ -21,5 +21,5 @@ tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' b
const o = Object.freeze({ a: 1, b: "string" });
o.b = o.a.toString();
~
!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
@@ -1,5 +1,5 @@
maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to type 'number'.
maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property.
maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a read-only property.
==== maxDepthExceeded/tsconfig.json (0 errors) ====
@@ -36,7 +36,7 @@ maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it i
!!! error TS2322: Type '"10"' is not assignable to type 'number'.
m1.rel = 42; // Error: Should be boolean
~~~
!!! error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'rel' because it is a read-only property.
m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any".
@@ -1,5 +1,5 @@
maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to type 'number'.
maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property.
maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a read-only property.
==== maxDepthExceeded/tsconfig.json (0 errors) ====
@@ -36,7 +36,7 @@ maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it i
!!! error TS2322: Type '"10"' is not assignable to type 'number'.
m1.rel = 42; // Error: Should be boolean
~~~
!!! error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'rel' because it is a read-only property.
m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any".
@@ -1,4 +1,4 @@
tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts(4,14): error TS2540: Cannot assign to 'attrib' because it is a constant or a read-only property.
tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts(4,14): error TS2540: Cannot assign to 'attrib' because it is a read-only property.
==== tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts (1 errors) ====
@@ -7,7 +7,7 @@ tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts(4,14): err
super()
this.attrib = 2
~~~~~~
!!! error TS2540: Cannot assign to 'attrib' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'attrib' because it is a read-only property.
}
}
@@ -1,4 +1,4 @@
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts(13,14): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts(13,14): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts(33,7): error TS2415: Class 'E' incorrectly extends base class 'D'.
Property 'x' is private in type 'D' but not in type 'E'.
@@ -18,7 +18,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/re
// Fails, x is readonly
this.x = 1;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
}
}
@@ -1,4 +1,4 @@
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(4,10): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(4,10): error TS2540: Cannot assign to 'x' because it is a read-only property.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(7,26): error TS1029: 'public' modifier must precede 'readonly' modifier.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(13,10): error TS2341: Property 'x' is private and only accessible within class 'F'.
@@ -9,7 +9,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/re
}
new C(1).x = 2;
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'x' because it is a read-only property.
class E {
constructor(readonly public x: number) {}
@@ -1,16 +1,16 @@
tests/cases/compiler/readonlyMembers.ts(6,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(7,3): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(16,14): error TS2540: Cannot assign to 'c' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(18,18): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(19,18): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(20,18): error TS2540: Cannot assign to 'c' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(24,14): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(25,14): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(26,14): error TS2540: Cannot assign to 'c' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(35,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(39,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(48,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(55,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(6,3): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(7,3): error TS2540: Cannot assign to 'b' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(16,14): error TS2540: Cannot assign to 'c' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(18,18): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(19,18): error TS2540: Cannot assign to 'b' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(20,18): error TS2540: Cannot assign to 'c' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(24,14): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(25,14): error TS2540: Cannot assign to 'b' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(26,14): error TS2540: Cannot assign to 'c' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(35,3): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(39,3): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(48,3): error TS2540: Cannot assign to 'A' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(55,3): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/compiler/readonlyMembers.ts(61,1): error TS2542: Index signature in type '{ readonly [x: string]: string; }' only permits reading.
tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in type '{ [x: string]: string; readonly [x: number]: string; }' only permits reading.
@@ -23,10 +23,10 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in
var x: X = { a: 0 };
x.a = 1; // Error
~
!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
x.b = 1; // Error
~
!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
class C {
readonly a: number;
@@ -37,29 +37,29 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in
this.b = 1; // Ok
this.c = 1; // Error
~
!!! error TS2540: Cannot assign to 'c' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'c' because it is a read-only property.
const f = () => {
this.a = 1; // Error
~
!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
this.b = 1; // Error
~
!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
this.c = 1; // Error
~
!!! error TS2540: Cannot assign to 'c' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'c' because it is a read-only property.
}
}
foo() {
this.a = 1; // Error
~
!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
this.b = 1; // Error
~
!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
this.c = 1; // Error
~
!!! error TS2540: Cannot assign to 'c' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'c' because it is a read-only property.
}
}
@@ -70,13 +70,13 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in
};
o.a = 1; // Error
~
!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
o.b = 1;
var p: { readonly a: number, b: number } = { a: 1, b: 1 };
p.a = 1; // Error
~
!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
p.b = 1;
var q: { a: number, b: number } = p;
q.a = 1;
@@ -87,7 +87,7 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in
}
E.A = 1; // Error
~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'A' because it is a read-only property.
namespace N {
export const a = 1;
@@ -96,7 +96,7 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in
}
N.a = 1; // Error
~
!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
N.b = 1;
N.c = 1;
@@ -1,7 +1,7 @@
tests/cases/compiler/redefineArray.ts(1,1): error TS2540: Cannot assign to 'Array' because it is a constant or a read-only property.
tests/cases/compiler/redefineArray.ts(1,1): error TS2588: Cannot assign to 'Array' because it is a constant.
==== tests/cases/compiler/redefineArray.ts (1 errors) ====
Array = function (n:number, s:string) {return n;};
~~~~~
!!! error TS2540: Cannot assign to 'Array' because it is a constant or a read-only property.
!!! error TS2588: Cannot assign to 'Array' because it is a constant.
@@ -1,7 +1,7 @@
tests/cases/conformance/types/union/unionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a read-only property.
tests/cases/conformance/types/union/unionTypeReadonly.ts(25,15): error TS2339: Property 'value' does not exist on type 'Base | DifferentName'.
Property 'value' does not exist on type 'DifferentName'.
@@ -25,19 +25,19 @@ tests/cases/conformance/types/union/unionTypeReadonly.ts(25,15): error TS2339: P
let base: Base;
base.value = 12 // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let identical: Base | Identical;
identical.value = 12; // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let mutable: Base | Mutable;
mutable.value = 12; // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let differentType: Base | DifferentType;
differentType.value = 12; // error, lhs can't be a readonly property
~~~~~
!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'value' because it is a read-only property.
let differentName: Base | DifferentName;
differentName.value = 12; // error, property 'value' doesn't exist
~~~~~
@@ -1,6 +1,6 @@
tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(11,3): error TS2339: Property 'bar' does not exist on type 'Missing'.
Property 'bar' does not exist on type '{ [s: string]: string; }'.
tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(14,4): error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property.
tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(14,4): error TS2540: Cannot assign to 'foo' because it is a read-only property.
tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(24,1): error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature.
tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(25,1): error TS2322: Type '"not ok"' is not assignable to type 'number'.
tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature.
@@ -25,7 +25,7 @@ tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error
declare var ro: RO
ro.foo = 'not allowed'
~~~
!!! error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'foo' because it is a read-only property.
type Num = { '0': string } | { [n: number]: number }
declare var num: Num
num[0] = 1
@@ -1,4 +1,4 @@
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(10,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(10,3): error TS2540: Cannot assign to 'A' because it is a read-only property.
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(15,1): error TS2539: Cannot assign to 'C' because it is not a variable.
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(20,1): error TS2693: 'I' only refers to a type, but is being used as a value here.
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(23,1): error TS2539: Cannot assign to 'M' because it is not a variable.
@@ -17,7 +17,7 @@ tests/cases/conformance/types/primitives/null/validNullAssignments.ts(30,1): err
enum E { A }
E.A = null; // error
~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
!!! error TS2540: Cannot assign to 'A' because it is a read-only property.
class C { foo: string }
var f: C;