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

Method getTargetOfImportSpecifier

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

Source from the content-addressed store, hash-verified

14571}
14572
14573func (c *Checker) getTargetOfImportSpecifier(node *ast.Node) *ast.Symbol {
14574 name := node.PropertyNameOrName()
14575 if ast.IsImportSpecifier(node) && ast.ModuleExportNameIsDefault(name) {
14576 specifier := c.getModuleSpecifierForImportOrExport(node)
14577 if specifier != nil {
14578 moduleSymbol := c.resolveExternalModuleName(node, specifier, false /*ignoreErrors*/)
14579 if moduleSymbol != nil {
14580 return c.getTargetOfModuleDefault(moduleSymbol, node, true /*dontResolveAlias*/)
14581 }
14582 }
14583 }
14584 root := node.Parent.Parent.Parent // ImportDeclaration
14585 if ast.IsBindingElement(node) {
14586 root = ast.GetRootDeclaration(node)
14587 }
14588 resolved := c.getExternalModuleMember(root, node, true /*dontResolveAlias*/)
14589 c.markSymbolOfAliasDeclarationIfTypeOnly(node, nil)
14590 return resolved
14591}
14592
14593func (c *Checker) getExternalModuleMember(node *ast.Node, specifier *ast.Node, dontResolveAlias bool) *ast.Symbol {
14594 // node is ImportDeclaration | ExportDeclaration | VariableDeclaration

Callers 1

Tested by

no test coverage detected