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

Function getTypeOfGlobalSymbol

test/fixtures/snapshot/typescript.js:60622–60650  ·  view source on GitHub ↗
(symbol, arity)

Source from the content-addressed store, hash-verified

60620 return links.resolvedType;
60621 }
60622 function getTypeOfGlobalSymbol(symbol, arity) {
60623 function getTypeDeclaration(symbol) {
60624 var declarations = symbol.declarations;
60625 if (declarations) {
60626 for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
60627 var declaration = declarations_3[_i];
60628 switch (declaration.kind) {
60629 case 257 /* SyntaxKind.ClassDeclaration */:
60630 case 258 /* SyntaxKind.InterfaceDeclaration */:
60631 case 260 /* SyntaxKind.EnumDeclaration */:
60632 return declaration;
60633 }
60634 }
60635 }
60636 }
60637 if (!symbol) {
60638 return arity ? emptyGenericType : emptyObjectType;
60639 }
60640 var type = getDeclaredTypeOfSymbol(symbol);
60641 if (!(type.flags & 524288 /* TypeFlags.Object */)) {
60642 error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, ts.symbolName(symbol));
60643 return arity ? emptyGenericType : emptyObjectType;
60644 }
60645 if (ts.length(type.typeParameters) !== arity) {
60646 error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, ts.symbolName(symbol), arity);
60647 return arity ? emptyGenericType : emptyObjectType;
60648 }
60649 return type;
60650 }
60651 function getGlobalValueSymbol(name, reportErrors) {
60652 return getGlobalSymbol(name, 111551 /* SymbolFlags.Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
60653 }

Callers 2

getGlobalTypeFunction · 0.85
getGlobalTypeOrUndefinedFunction · 0.85

Calls 4

getDeclaredTypeOfSymbolFunction · 0.85
getTypeDeclarationFunction · 0.85
errorFunction · 0.70
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…