|
| 1 | +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(17,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 2 | +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 3 | +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(21,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 4 | +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(23,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 5 | +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(25,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 6 | + |
| 7 | + |
| 8 | +==== tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts (5 errors) ==== |
| 9 | + interface Base { |
| 10 | + readonly value: number; |
| 11 | + } |
| 12 | + interface Identical { |
| 13 | + readonly value: number; |
| 14 | + } |
| 15 | + interface Mutable { |
| 16 | + value: number; |
| 17 | + } |
| 18 | + interface DifferentType { |
| 19 | + readonly value: string; |
| 20 | + } |
| 21 | + interface DifferentName { |
| 22 | + readonly other: number; |
| 23 | + } |
| 24 | + let base: Base; |
| 25 | + base.value = 12 // error, lhs can't be a readonly property |
| 26 | + ~~~~~~~~~~ |
| 27 | +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 28 | + let identical: Base & Identical; |
| 29 | + identical.value = 12; // error, lhs can't be a readonly property |
| 30 | + ~~~~~~~~~~~~~~~ |
| 31 | +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 32 | + let mutable: Base & Mutable; |
| 33 | + mutable.value = 12; // error, lhs can't be a readonly property |
| 34 | + ~~~~~~~~~~~~~ |
| 35 | +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 36 | + let differentType: Base & DifferentType; |
| 37 | + differentType.value = 12; // error, lhs can't be a readonly property |
| 38 | + ~~~~~~~~~~~~~~~~~~~ |
| 39 | +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 40 | + let differentName: Base & DifferentName; |
| 41 | + differentName.value = 12; // error, property 'value' doesn't exist |
| 42 | + ~~~~~~~~~~~~~~~~~~~ |
| 43 | +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. |
| 44 | + |
0 commit comments