MCPcopy Index your code
hub / github.com/nodejs/node / getFlowTypeFromCommonJSExport

Function getFlowTypeFromCommonJSExport

test/fixtures/snapshot/typescript.js:56098–56112  ·  view source on GitHub ↗

Create a synthetic property access flow node after the last statement of the file

(symbol)

Source from the content-addressed store, hash-verified

56096 }
56097 /** Create a synthetic property access flow node after the last statement of the file */
56098 function getFlowTypeFromCommonJSExport(symbol) {
56099 var file = ts.getSourceFileOfNode(symbol.declarations[0]);
56100 var accessName = ts.unescapeLeadingUnderscores(symbol.escapedName);
56101 var areAllModuleExports = symbol.declarations.every(function (d) { return ts.isInJSFile(d) && ts.isAccessExpression(d) && ts.isModuleExportsAccessExpression(d.expression); });
56102 var reference = areAllModuleExports
56103 ? ts.factory.createPropertyAccessExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("module"), ts.factory.createIdentifier("exports")), accessName)
56104 : ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("exports"), accessName);
56105 if (areAllModuleExports) {
56106 ts.setParent(reference.expression.expression, reference.expression);
56107 }
56108 ts.setParent(reference.expression, reference);
56109 ts.setParent(reference, file);
56110 reference.flowNode = file.endFlowNode;
56111 return getFlowTypeOfReference(reference, autoType, undefinedType);
56112 }
56113 function getFlowTypeInStaticBlocks(symbol, staticBlocks) {
56114 var accessName = ts.startsWith(symbol.escapedName, "__#")
56115 ? ts.factory.createPrivateIdentifier(symbol.escapedName.split("@")[1])

Callers 1

getTypeOfAliasFunction · 0.85

Calls 2

getFlowTypeOfReferenceFunction · 0.85
everyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…