import { ImportDeclaration } from "https://dotland.deno.dev/x/ts_morph@17.0.0/ts_morph.d.ts";
Methods
addNamedImport(namedImport: OptionalKind<ImportSpecifierStructure> | string | WriterFunction): ImportSpecifier
Adds a named import.
addNamedImports(namedImports: ReadonlyArray<OptionalKind<ImportSpecifierStructure> | string | WriterFunction> | WriterFunction): ImportSpecifier[]
Adds named imports.
getAssertClause(): AssertClause | undefined
Gets the assert clause or returns undefined if it doesn't exist.
getDefaultImport(): Identifier | undefined
Gets the default import or returns undefined if it doesn't exist.
getDefaultImportOrThrow(message?: string | (() => string)): Identifier
Gets the default import or throws if it doesn't exit.
getImportClause(): ImportClause | undefined
Gets the import clause or returns undefined if it doesn't exist.
getImportClauseOrThrow(message?: string | (() => string)): ImportClause
Gets the import clause or throws if it doesn't exist.
getModuleSpecifierSourceFile(): SourceFile | undefined
Gets the source file referenced in the module specifier or returns undefined if it can't find it.
getModuleSpecifierSourceFileOrThrow(message?: string | (() => string)): SourceFile
Gets the source file referenced in the module specifier or throws if it can't find it.
getNamespaceImportOrThrow(message?: string | (() => string)): Identifier
Gets the namespace import if it exists or throws.
getParent(): NodeParentType<ts.ImportDeclaration>
getParentOrThrow(message?: string | (() => string)): NonNullable<NodeParentType<ts.ImportDeclaration>>
insertNamedImport(index: number, namedImport: OptionalKind<ImportSpecifierStructure> | string | WriterFunction): ImportSpecifier
Inserts a named import.
insertNamedImports(index: number, namedImports: ReadonlyArray<OptionalKind<ImportSpecifierStructure> | string | WriterFunction> | WriterFunction): ImportSpecifier[]
Inserts named imports into the import declaration.
setAssertElements(elements: ReadonlyArray<OptionalKind<AssertEntryStructure>> | undefined): this
Sets the elements in an assert clause.