Skip to main content
Module

x/ts_morph/mod.ts>ModuleDeclaration

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

Methods

getDeclarationKind(): ModuleDeclarationKind

Gets the namesapce declaration kind.

getDeclarationKindKeyword(): Node<ts.Node> | undefined

Gets the namespace or module keyword or returns undefined if it's global.

getName(): string

Gets the full name of the namespace.

getNameNodes(): Identifier[] | StringLiteral

Gets the name nodes or the string literal.

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

Gets the structure equivalent to this node.

hasModuleKeyword(): boolean

Gets if this namespace has a namespace keyword.

Gets if this namespace has a namespace keyword.

rename(newName: string, options?: RenameOptions): this

Renames the module name.

Note: The TS compiler does not update module declarations for string literal module names unfortunately.

set(structure: Partial<ModuleDeclarationStructure>): this

Sets the node from a structure.

setDeclarationKind(kind: ModuleDeclarationKind): this

Sets the namespace declaration kind.

setName(newName: string): this

Sets the name without renaming references.