Skip to main content
Module

x/ts_morph/mod.ts>ExportDeclaration

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

Methods

addNamedExport(namedExport: OptionalKind<ExportSpecifierStructure> | string | WriterFunction): ExportSpecifier

Adds a named export.

addNamedExports(namedExports: ReadonlyArray<OptionalKind<ExportSpecifierStructure> | string | WriterFunction> | WriterFunction): ExportSpecifier[]

Adds named exports.

getAssertClause(): AssertClause | undefined

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

getModuleSpecifier(): StringLiteral | undefined

Gets the module specifier or undefined if it doesn't exist.

getModuleSpecifierSourceFile(): SourceFile | undefined

Gets the source file referenced in the module specifier.

getModuleSpecifierSourceFileOrThrow(message?: string | (() => string)): SourceFile

Gets the source file referenced in the module specifier or throws if it can't find it or it doesn't exist.

getModuleSpecifierValue(): string | undefined

Gets the module specifier value or undefined if it doesn't exist.

getNamedExports(): ExportSpecifier[]

Gets the named exports.

getNamespaceExport(): NamespaceExport | undefined

Gets the namespace export or returns undefined if it doesn't exist. (ex. * as ns, but not *).

getNamespaceExportOrThrow(message?: string | (() => string)): NamespaceExport

Gets the namespace export or throws if it doesn't exist. (ex. * as ns, but not *)

getParent(): NodeParentType<ts.ExportDeclaration>
getParentOrThrow(message?: string | (() => string)): NonNullable<NodeParentType<ts.ExportDeclaration>>
getStructure(): ExportDeclarationStructure

Gets the structure equivalent to this node.

Gets if the module specifier exists

hasNamedExports(): boolean

Gets if the export declaration has named exports.

insertNamedExport(index: number, namedExport: OptionalKind<ExportSpecifierStructure> | string | WriterFunction): ExportSpecifier

Inserts a named export.

insertNamedExports(index: number, namedExports: ReadonlyArray<OptionalKind<ExportSpecifierStructure> | string | WriterFunction> | WriterFunction): ExportSpecifier[]

Inserts named exports into the export declaration.

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

Gets if this export declaration is a namespace export.

isTypeOnly(): boolean

Gets if this export declaration is type only.

Removes the module specifier.

set(structure: Partial<ExportDeclarationStructure>): this

Sets the node from a structure.

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

Sets the elements in an assert clause.

setIsTypeOnly(value: boolean): this

Sets if this export declaration is type only.

setModuleSpecifier(text: string): this

Sets the import specifier.

setModuleSpecifier(sourceFile: SourceFile): this

Sets the import specifier.

setNamespaceExport(name: string): this

Sets the namespace export name.

Changes the export declaration to namespace export. Removes all the named exports.