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(): string
Returns
string
:The name of symbol that is imported
-
getTSNode
codeThe original TypeScript node
getTSNode(): ImportDeclaration
Returns
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(): ProjectContext
Returns
ProjectContext
:The analyser context
-
getNodeType
codeThe reflected node kind
getNodeType(): RootNodeType
Returns
RootNodeType
:The import declaration kind
-
getKind
codeThe reflected import kind
getKind(): ImportKind
Returns
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(): string
Returns
string
:The referenced symbol name
-
getImportPath
codeThe path used in the import declaration
getImportPath(): string
Returns
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(): string
Returns
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(): boolean
Returns
boolean
:True if the imported symbol uses the
type
keyword -
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(): boolean
Returns
boolean
:True if the import specifier is a bare module specifier, otherwise false
-
serialize
codeSerializes the reflected node
serialize(): Import
Returns
Import
:The reflected node as a serializable object