Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ts_morph/ts_morph.d.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@17.0.0/ts_morph.d.ts";

Methods

Adds named exports.

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

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

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.

Gets the named exports.

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

Gets the structure equivalent to this node.

Gets if the module specifier exists

hasNamedExports(): boolean

Gets if the export declaration has named exports.

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.