@ts-ast-parser/core
Version:
Reflects a simplified version of the TypeScript AST for generating documentation
95 lines • 2.98 kB
TypeScript
import type { ReflectedRootNode } from '../reflected-node.js';
import type { ProjectContext } from '../project-context.js';
import type { Import } from '../models/import.js';
import { ImportKind } from '../models/import.js';
import { RootNodeType } from '../models/node.js';
import type ts from 'typescript';
/**
* Represents the reflected node of a default import declaration.
*
* For example `import x from 'y'`.
*/
export declare class DefaultImportNode implements ReflectedRootNode<Import, ts.ImportDeclaration> {
private readonly _node;
private readonly _context;
constructor(node: ts.ImportDeclaration, context: ProjectContext);
/**
* The name of symbol that is imported
*
* @returns The name of symbol that is imported
*/
getName(): string;
/**
* The original TypeScript node
*
* @returns The TypeScript AST node related to this relfected node
*/
getTSNode(): ts.ImportDeclaration;
/**
* 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
*
* @returns The analyser context
*/
getContext(): ProjectContext;
/**
* The reflected node kind
*
* @returns The import declaration kind
*/
getNodeType(): RootNodeType;
/**
* The reflected import kind
*
* @returns The default import kind
*/
getKind(): ImportKind;
/**
* 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()`.
*
* @returns The referenced symbol name
*/
getReferenceName(): string;
/**
* The path used in the import declaration
*
* @returns The path specified in the import declaration. This may not be the
* real path if you're using an alias
*/
getImportPath(): string;
/**
* If the path matches a TSConfig file path, this will be the original
* source path from where the symbol is being imported
*
* @returns The real path where the symbol is located
*/
getOriginalPath(): string;
/**
* Whether it's a type only import.
* For example: `import type x from 'y'`
*
* @returns True if the imported symbol uses the `type` keyword
*/
isTypeOnly(): boolean;
/**
* Bare module specifiers let you import modules without specifying
* the absolute/relative path where the module is located.
*
* For example: `import lodash from 'lodash'`
*
* @returns True if the import specifier is a bare module specifier, otherwise false
*/
isBareModuleSpecifier(): boolean;
/**
* Serializes the reflected node
*
* @returns The reflected node as a serializable object
*/
serialize(): Import;
}
//# sourceMappingURL=default-import-node.d.ts.map