Skip to main content
Module

x/ts_morph/mod.ts>JsxAttribute

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

Methods

getInitializer():
| JsxElement
| JsxExpression
| JsxFragment
| JsxSelfClosingElement
| StringLiteral
| undefined

Gets the JSX attribute's initializer or returns undefined if it doesn't exist.

getInitializerOrThrow(message?: string | (() => string)):
| StringLiteral
| JsxElement
| JsxSelfClosingElement
| JsxFragment
| JsxExpression

Gets the JSX attribute's initializer or throws if it doesn't exist.

getNameNode(): JsxAttributeName

Gets the name node of the JSX attribute.

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

Gets the structure equivalent to this node.

remove(): void

Removes the JSX attribute.

Removes the initializer.

set(structure: Partial<JsxAttributeStructure>): this

Sets the node from a structure.

setInitializer(textOrWriterFunction: string | WriterFunction): this

Sets the initializer.

setName(name: string | JsxNamespacedNameStructure): this

Sets the name of the JSX attribute.