🚧 Still under progress. Soon will be finished.

DefaultImportNode

CLASS code

Description

Represents the reflected node of a default import declaration. For example import x from 'y'.

Methods

  • getName

    code

    The name of symbol that is imported

    getName(): string

    Returns

    string:

    The name of symbol that is imported

  • getTSNode

    code

    The original TypeScript node

    getTSNode(): ImportDeclaration

    Returns

    ImportDeclaration:

    The TypeScript AST node related to this relfected node

  • getContext

    code

    The 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

    code

    The reflected node kind

    getNodeType(): RootNodeType

    Returns

    RootNodeType:

    The import declaration kind

  • getKind

    code

    The reflected import kind

    getKind(): ImportKind

    Returns

    ImportKind:

    The default import kind

  • getReferenceName

    code

    An 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

    code

    The 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

    code

    If 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

    code

    Whether 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

    code

    Bare 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

    code

    Serializes the reflected node

    serialize(): Import

    Returns

    Import:

    The reflected node as a serializable object