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

Function inferFromIntraExpressionSites

test/fixtures/snapshot/typescript.js:68092–68105  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

68090 // infer from each argument before processing the next), but when the arrow functions are elements of an
68091 // object or array literal, we need to perform intra-expression inferences early.
68092 function inferFromIntraExpressionSites(context) {
68093 if (context.intraExpressionInferenceSites) {
68094 for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) {
68095 var _b = _a[_i], node = _b.node, type = _b.type;
68096 var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ?
68097 getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) :
68098 getContextualType(node, 2 /* ContextFlags.NoConstraints */);
68099 if (contextualType) {
68100 inferTypes(context.inferences, type, contextualType);
68101 }
68102 }
68103 context.intraExpressionInferenceSites = undefined;
68104 }
68105 }
68106 function createInferenceInfo(typeParameter) {
68107 return {
68108 typeParameter: typeParameter,

Callers 1

mapToInferredTypeFunction · 0.85

Calls 3

getContextualTypeFunction · 0.85
inferTypesFunction · 0.85

Tested by

no test coverage detected