Description
Represents the reflected node of a default import declaration.
For example import x from 'y'.
Methods
-
getName
codeThe name of symbol that is imported
getName(): stringReturns
string:The name of symbol that is imported
-
getTSNode
codeThe original TypeScript node
getTSNode(): ImportDeclarationReturns
ImportDeclaration:The TypeScript AST node related to this relfected node
-
getContext
codeThe context includes useful APIs that are shared across all the reflected symbols. Some APIs include the parsed configuration options, the system interface, the type checker
getContext(): ProjectContextReturns
ProjectContext:The analyser context
-
getNodeType
codeThe reflected node kind
getNodeType(): RootNodeTypeReturns
RootNodeType:The import declaration kind
-
getKind
codeThe reflected import kind
getKind(): ImportKindReturns
ImportKind:The default import kind
-
getReferenceName
codeAn import may be an alias to another symbol. For default imports it won’t happen. This method as of right now is an alias to
getName().getReferenceName(): stringReturns
string:The referenced symbol name
-
getImportPath
codeThe path used in the import declaration
getImportPath(): stringReturns
string:The path specified in the import declaration. This may not be the real path if you’re using an alias
-
getOriginalPath
codeIf the path matches a TSConfig file path, this will be the original source path from where the symbol is being imported
getOriginalPath(): stringReturns
string:The real path where the symbol is located
-
isTypeOnly
codeWhether it’s a type only import. For example:
import type x from 'y'isTypeOnly(): booleanReturns
boolean:True if the imported symbol uses the
typekeyword -
isBareModuleSpecifier
codeBare module specifiers let you import modules without specifying the absolute/relative path where the module is located. For example:
import lodash from 'lodash'isBareModuleSpecifier(): booleanReturns
boolean:True if the import specifier is a bare module specifier, otherwise false
-
serialize
codeSerializes the reflected node
serialize(): ImportReturns
Import:The reflected node as a serializable object