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

Function getDeclaredTypeOfTypeAlias

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

Source from the content-addressed store, hash-verified

57381 return links.declaredType;
57382 }
57383 function getDeclaredTypeOfTypeAlias(symbol) {
57384 var _a;
57385 var links = getSymbolLinks(symbol);
57386 if (!links.declaredType) {
57387 // Note that we use the links object as the target here because the symbol object is used as the unique
57388 // identity for resolution of the 'type' property in SymbolLinks.
57389 if (!pushTypeResolution(symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) {
57390 return errorType;
57391 }
57392 var declaration = ts.Debug.checkDefined((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isTypeAlias), "Type alias symbol with no valid declaration found");
57393 var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
57394 // If typeNode is missing, we will error in checkJSDocTypedefTag.
57395 var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
57396 if (popTypeResolution()) {
57397 var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
57398 if (typeParameters) {
57399 // Initialize the instantiation cache for generic type aliases. The declared type corresponds to
57400 // an instantiation of the type alias with the type parameters supplied as type arguments.
57401 links.typeParameters = typeParameters;
57402 links.instantiations = new ts.Map();
57403 links.instantiations.set(getTypeListId(typeParameters), type);
57404 }
57405 }
57406 else {
57407 type = errorType;
57408 if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) {
57409 error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57410 }
57411 else {
57412 error(ts.isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57413 }
57414 }
57415 links.declaredType = type;
57416 }
57417 return links.declaredType;
57418 }
57419 function isStringConcatExpression(expr) {
57420 if (ts.isStringLiteralLike(expr)) {
57421 return true;

Callers 2

serializeTypeAliasFunction · 0.85

Calls 10

getSymbolLinksFunction · 0.85
pushTypeResolutionFunction · 0.85
getTypeFromTypeNodeFunction · 0.85
popTypeResolutionFunction · 0.85
getTypeListIdFunction · 0.85
symbolToStringFunction · 0.85
errorFunction · 0.70
findMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…