(errNode, type, expression, checkMode)
| 77318 | return false; |
| 77319 | } |
| 77320 | function checkAssertionWorker(errNode, type, expression, checkMode) { |
| 77321 | var exprType = checkExpression(expression, checkMode); |
| 77322 | if (ts.isConstTypeReference(type)) { |
| 77323 | if (!isValidConstAssertionArgument(expression)) { |
| 77324 | error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); |
| 77325 | } |
| 77326 | return getRegularTypeOfLiteralType(exprType); |
| 77327 | } |
| 77328 | checkSourceElement(type); |
| 77329 | exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(exprType)); |
| 77330 | var targetType = getTypeFromTypeNode(type); |
| 77331 | if (!isErrorType(targetType)) { |
| 77332 | addLazyDiagnostic(function () { |
| 77333 | var widenedType = getWidenedType(exprType); |
| 77334 | if (!isTypeComparableTo(targetType, widenedType)) { |
| 77335 | checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first); |
| 77336 | } |
| 77337 | }); |
| 77338 | } |
| 77339 | return targetType; |
| 77340 | } |
| 77341 | function checkNonNullChain(node) { |
| 77342 | var leftType = checkExpression(node.expression); |
| 77343 | var nonOptionalType = getOptionalExpressionType(leftType, node.expression); |
no test coverage detected