Skip to main content
Module

x/ts_morph/ts_morph.d.ts>BodyableNode

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Very Popular
Go to Latest
interface BodyableNode
import { type BodyableNode } from "https://deno.land/x/ts_morph@15.1.0/ts_morph.d.ts";

Methods

getBodyOrThrow(): Node

Gets the body or throws an error if it doesn't exist.

getBody(): Node | undefined

Gets the body if it exists.

getBodyText(): string | undefined

Gets the body text without leading whitespace, leading indentation, or trailing whitespace. Returns undefined if there is no body.

hasBody(): boolean

Gets if the node has a body.

setBodyText(textOrWriterFunction: string | WriterFunction): this

Sets the body text. A body is required to do this operation.

addBody(): this

Adds a body if it doesn't exists.

removeBody(): this

Removes the body if it exists.

function BodyableNode
import { BodyableNode } from "https://deno.land/x/ts_morph@15.1.0/ts_morph.d.ts";

Type Parameters

T extends Constructor<BodyableNodeExtensionType>