Skip to main content
Module

x/ts_morph/ts_morph.d.ts>ImportSpecifier

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Very Popular
Go to Latest
class ImportSpecifier
extends ImportSpecifierBase<ts.ImportSpecifier>
import { ImportSpecifier } from "https://deno.land/x/ts_morph@15.1.0/ts_morph.d.ts";

Methods

getAliasNode(): Identifier | undefined

Gets the alias identifier, if it exists.

Gets the import declaration associated with this import specifier.

getName(): string

Gets the name of the import specifier.

Gets the name node of what's being imported.

getParent(): NodeParentType<ts.ImportSpecifier>
getParentOrThrow(): NonNullable<NodeParentType<ts.ImportSpecifier>>

Gets the structure equivalent to this node.

isTypeOnly(): boolean

Gets if this is a type only import specifier.

remove(): void

Remove the import specifier.

removeAlias(): this

Removes the alias without renaming.

Removes the alias and renames any usages to the name of the import specifier.

renameAlias(alias: string): this

Sets the alias for the name being imported and renames all the usages.

set(structure: Partial<ImportSpecifierStructure>): this

Sets the node from a structure.

setAlias(alias: string): this

Sets the alias without renaming all the usages.

setIsTypeOnly(value: boolean): this

Sets if this is a type only import specifier.

setName(name: string): this

Sets the identifier being imported.