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

Function maybeAddMissingAwaitInfo

test/fixtures/snapshot/typescript.js:75771–75782  ·  view source on GitHub ↗
(errorNode, source, target)

Source from the content-addressed store, hash-verified

75769 }
75770 return undefined;
75771 function maybeAddMissingAwaitInfo(errorNode, source, target) {
75772 if (errorNode && reportErrors && errorOutputContainer.errors && errorOutputContainer.errors.length) {
75773 // Bail if target is Promise-like---something else is wrong
75774 if (getAwaitedTypeOfPromise(target)) {
75775 return;
75776 }
75777 var awaitedTypeOfSource = getAwaitedTypeOfPromise(source);
75778 if (awaitedTypeOfSource && isTypeRelatedTo(awaitedTypeOfSource, target, relation)) {
75779 ts.addRelatedInfo(errorOutputContainer.errors[0], ts.createDiagnosticForNode(errorNode, ts.Diagnostics.Did_you_forget_to_use_await));
75780 }
75781 }
75782 }
75783 }
75784 /**
75785 * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.

Callers 1

Calls 2

getAwaitedTypeOfPromiseFunction · 0.85
isTypeRelatedToFunction · 0.85

Tested by

no test coverage detected