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

Function getFlowTypeInConstructor

test/fixtures/snapshot/typescript.js:56134–56148  ·  view source on GitHub ↗
(symbol, constructor)

Source from the content-addressed store, hash-verified

56132 }
56133 }
56134 function getFlowTypeInConstructor(symbol, constructor) {
56135 var accessName = ts.startsWith(symbol.escapedName, "__#")
56136 ? ts.factory.createPrivateIdentifier(symbol.escapedName.split("@")[1])
56137 : ts.unescapeLeadingUnderscores(symbol.escapedName);
56138 var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), accessName);
56139 ts.setParent(reference.expression, reference);
56140 ts.setParent(reference, constructor);
56141 reference.flowNode = constructor.returnFlowNode;
56142 var flowType = getFlowTypeOfProperty(reference, symbol);
56143 if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
56144 error(symbol.valueDeclaration, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
56145 }
56146 // We don't infer a type if assignments are only null or undefined.
56147 return everyType(flowType, isNullableType) ? undefined : convertAutoToAny(flowType);
56148 }
56149 function getFlowTypeOfProperty(reference, prop) {
56150 var initialType = (prop === null || prop === void 0 ? void 0 : prop.valueDeclaration)
56151 && (!isAutoTypedProperty(prop) || ts.getEffectiveModifierFlags(prop.valueDeclaration) & 2 /* ModifierFlags.Ambient */)

Calls 7

getFlowTypeOfPropertyFunction · 0.85
symbolToStringFunction · 0.85
typeToStringFunction · 0.85
everyTypeFunction · 0.85
convertAutoToAnyFunction · 0.85
errorFunction · 0.70
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…