MCPcopy Create free account
hub / github.com/microsoft/typescript-go / getTargetOfAliasDeclaration

Method getTargetOfAliasDeclaration

internal/checker/checker.go:15649–15680  ·  view source on GitHub ↗
(node *ast.Node)

Source from the content-addressed store, hash-verified

15647}
15648
15649func (c *Checker) getTargetOfAliasDeclaration(node *ast.Node) *ast.Symbol {
15650 if node == nil {
15651 return nil
15652 }
15653 switch node.Kind {
15654 case ast.KindImportEqualsDeclaration, ast.KindVariableDeclaration:
15655 return c.getTargetOfImportEqualsDeclaration(node)
15656 case ast.KindImportClause:
15657 return c.getTargetOfImportClause(node)
15658 case ast.KindNamespaceImport:
15659 return c.getTargetOfNamespaceImport(node)
15660 case ast.KindNamespaceExport:
15661 return c.getTargetOfNamespaceExport(node)
15662 case ast.KindImportSpecifier, ast.KindBindingElement:
15663 return c.getTargetOfImportSpecifier(node)
15664 case ast.KindExportSpecifier:
15665 return c.getTargetOfExportSpecifier(node, ast.SymbolFlagsValue|ast.SymbolFlagsType|ast.SymbolFlagsNamespace, true /*dontRecursivelyResolve*/)
15666 case ast.KindExportAssignment:
15667 return c.getTargetOfExportAssignment(node)
15668 case ast.KindBinaryExpression:
15669 return c.getTargetOfBinaryExpression(node)
15670 case ast.KindNamespaceExportDeclaration:
15671 return c.getTargetOfNamespaceExportDeclaration(node)
15672 case ast.KindShorthandPropertyAssignment:
15673 return c.resolveEntityName(node.AsShorthandPropertyAssignment().Name(), ast.SymbolFlagsValue|ast.SymbolFlagsType|ast.SymbolFlagsNamespace, true /*ignoreErrors*/, true /*dontRecursivelyResolve*/, nil /*location*/)
15674 case ast.KindPropertyAssignment:
15675 return c.getTargetOfAliasLikeExpression(node.Initializer())
15676 case ast.KindElementAccessExpression, ast.KindPropertyAccessExpression:
15677 return c.getTargetOfAccessExpression(node)
15678 }
15679 panic("Unhandled case in getTargetOfAliasDeclaration: " + node.Kind.String())
15680}
15681
15682/**
15683 * Resolves a qualified name and any involved aliases.

Callers 4

resolveAliasMethod · 0.95
getTypeOfAliasMethod · 0.95
expandModuleDeclMethod · 0.80

Tested by

no test coverage detected