()
| 79281 | addLazyDiagnostic(checkAssignmentOperatorWorker); |
| 79282 | } |
| 79283 | function checkAssignmentOperatorWorker() { |
| 79284 | // TypeScript 1.0 spec (April 2014): 4.17 |
| 79285 | // An assignment of the form |
| 79286 | // VarExpr = ValueExpr |
| 79287 | // requires VarExpr to be classified as a reference |
| 79288 | // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) |
| 79289 | // and the type of the non-compound operation to be assignable to the type of VarExpr. |
| 79290 | if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access) |
| 79291 | && (!ts.isIdentifier(left) || ts.unescapeLeadingUnderscores(left.escapedText) !== "exports")) { |
| 79292 | var headMessage = void 0; |
| 79293 | if (exactOptionalPropertyTypes && ts.isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 32768 /* TypeFlags.Undefined */)) { |
| 79294 | var target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText); |
| 79295 | if (isExactOptionalPropertyMismatch(valueType, target)) { |
| 79296 | headMessage = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target; |
| 79297 | } |
| 79298 | } |
| 79299 | // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported |
| 79300 | checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right, headMessage); |
| 79301 | } |
| 79302 | } |
| 79303 | } |
| 79304 | function isAssignmentDeclaration(kind) { |
| 79305 | var _a; |
nothing calls this directly
no test coverage detected