Skip to main content
Module

x/ts_morph/mod.ts>ShorthandPropertyAssignment

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

Methods

getEqualsToken(): Node<ts.EqualsToken> | undefined

Gets the equals token if it exists.

getEqualsTokenOrThrow(): Node<ts.EqualsToken>

Gets the equals token or throws if it doesn't exist.

Gets the object assignment initializer if it exists.

Gets the object assignment initializer or throws if it doesn't exist.

getParent(): NodeParentType<ts.ShorthandPropertyAssignment>
getParentOrThrow(): NonNullable<NodeParentType<ts.ShorthandPropertyAssignment>>

Gets the structure equivalent to this node.

Gets if the shorthand property assignment has an object assignment initializer.

Remove the object assignment initializer.

This is only useful to remove bad code.

set(structure: Partial<ShorthandPropertyAssignmentStructure>): this

Sets the node from a structure.

Sets the initializer.

Note: The current node will no longer be valid because it's no longer a shorthand property assignment.