Skip to main content
Module

x/deno2node/src/deps.deno.ts>ImportDeclaration

Compile your Deno project to run on Node.js.
Go to Latest
class ImportDeclaration
extends ImportDeclarationBase<ts.ImportDeclaration>
import { ImportDeclaration } from "https://deno.land/x/deno2node@v1.7.1/src/deps.deno.ts";

Methods

Adds named imports.

Gets the assert clause or returns undefined if it doesn't exist.

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.

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.

Gets the module specifier.

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.

Gets the module specifier string literal value.

Gets the named imports.

Gets the namespace import identifier, if it exists.

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>>

Gets the structure equivalent to this node.

Inserts a named import.

insertNamedImports(index: number, namedImports: ReadonlyArray<OptionalKind<ImportSpecifierStructure> | string | WriterFunction> | WriterFunction): ImportSpecifier[]

Inserts named imports into the import declaration.

Gets if the module specifier starts with ./ or ../.

isTypeOnly(): boolean

Gets if this import declaration is type only.

Removes the default import.

Removes all the named imports.

Removes the namespace import.

renameDefaultImport(text: string): this

Renames or sets the provided default import.

set(structure: Partial<ImportDeclarationStructure>): this

Sets the node from a structure.

setAssertElements(elements: ReadonlyArray<OptionalKind<AssertEntryStructure>> | undefined): this

Sets the elements in an assert clause.

setDefaultImport(text: string): this

Sets the default import.

setIsTypeOnly(value: boolean): this

Sets if this import declaration is type only.

setModuleSpecifier(text: string): this

Sets the import specifier.

setModuleSpecifier(sourceFile: SourceFile): this

Sets the import specifier.

setNamespaceImport(text: string): this

Sets the namespace import.