MCPcopy Create free account
hub / github.com/nodejs/node / checkAwaitExpression

Function checkAwaitExpression

test/fixtures/snapshot/typescript.js:78455–78463  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

78453 }
78454 }
78455 function checkAwaitExpression(node) {
78456 addLazyDiagnostic(function () { return checkAwaitExpressionGrammar(node); });
78457 var operandType = checkExpression(node.expression);
78458 var awaitedType = checkAwaitedType(operandType, /*withAlias*/ true, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
78459 if (awaitedType === operandType && !isErrorType(awaitedType) && !(operandType.flags & 3 /* TypeFlags.AnyOrUnknown */)) {
78460 addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
78461 }
78462 return awaitedType;
78463 }
78464 function checkPrefixUnaryExpression(node) {
78465 var operandType = checkExpression(node.operand);
78466 if (operandType === silentNeverType) {

Callers 1

checkExpressionWorkerFunction · 0.85

Calls 6

addLazyDiagnosticFunction · 0.85
checkAwaitedTypeFunction · 0.85
isErrorTypeFunction · 0.85
addErrorOrSuggestionFunction · 0.85
checkExpressionFunction · 0.70

Tested by

no test coverage detected