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

Function getTypeOfAlias

test/fixtures/snapshot/typescript.js:56809–56827  ·  view source on GitHub ↗
(symbol)

Source from the content-addressed store, hash-verified

56807 return links.type || (links.type = getDeclaredTypeOfEnumMember(symbol));
56808 }
56809 function getTypeOfAlias(symbol) {
56810 var links = getSymbolLinks(symbol);
56811 if (!links.type) {
56812 var targetSymbol = resolveAlias(symbol);
56813 var exportSymbol = symbol.declarations && getTargetOfAliasDeclaration(getDeclarationOfAliasSymbol(symbol), /*dontResolveAlias*/ true);
56814 var declaredType = ts.firstDefined(exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations, function (d) { return ts.isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : undefined; });
56815 // It only makes sense to get the type of a value symbol. If the result of resolving
56816 // the alias is not a value, then it has no type. To get the type associated with a
56817 // type symbol, call getDeclaredTypeOfSymbol.
56818 // This check is important because without it, a call to getTypeOfSymbol could end
56819 // up recursively calling getTypeOfAlias, causing a stack overflow.
56820 links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
56821 : isDuplicatedCommonJSExport(symbol.declarations) ? autoType
56822 : declaredType ? declaredType
56823 : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
56824 : errorType;
56825 }
56826 return links.type;
56827 }
56828 function getTypeOfInstantiatedSymbol(symbol) {
56829 var links = getSymbolLinks(symbol);
56830 return links.type || (links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper));

Callers 1

getTypeOfSymbolFunction · 0.85

Calls 8

getSymbolLinksFunction · 0.85
resolveAliasFunction · 0.85
getTypeOfSymbolFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…