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

Function getTypeFromJSDocValueReference

test/fixtures/snapshot/typescript.js:60438–60453  ·  view source on GitHub ↗

* A JSdoc TypeReference may be to a value, but resolve it as a type anyway. * Example: import('./b').ConstructorFunction

(node, symbol)

Source from the content-addressed store, hash-verified

60436 * Example: import('./b').ConstructorFunction
60437 */
60438 function getTypeFromJSDocValueReference(node, symbol) {
60439 var links = getNodeLinks(node);
60440 if (!links.resolvedJSDocType) {
60441 var valueType = getTypeOfSymbol(symbol);
60442 var typeType = valueType;
60443 if (symbol.valueDeclaration) {
60444 var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier;
60445 // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL}
60446 if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) {
60447 typeType = getTypeReferenceType(node, valueType.symbol);
60448 }
60449 }
60450 links.resolvedJSDocType = typeType;
60451 }
60452 return links.resolvedJSDocType;
60453 }
60454 function getSubstitutionType(baseType, substitute) {
60455 if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) {
60456 return baseType;

Callers 1

getTypeReferenceTypeFunction · 0.85

Calls 3

getNodeLinksFunction · 0.85
getTypeOfSymbolFunction · 0.85
getTypeReferenceTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…