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

x/ts_morph/ts_morph.d.ts>ObjectLiteralExpression

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

Methods

Adds get accessors.

Adds methods.

Adds the specified properties to the object literal expression.

Note: If you only want to add property assignments, then it might be more convenient to use #addPropertyAssignments.

Adds the specified property to the object literal expression.

Note: If you only want to add a property assignment, then it might be more convenient to use #addPropertyAssignment.

Adds property assignments.

Adds set accessors.

Adds shorthand property assignments.

Adds spread assignments.

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

Gets the properties.

Gets the properties with comment object literal elements.

getProperty(name: string): ObjectLiteralElementLike | undefined

Gets the first property by the provided name or returns undefined.

getProperty(findFunction: (property: ObjectLiteralElementLike) => boolean): ObjectLiteralElementLike | undefined

Gets the first property that matches the provided find function or returns undefined.

Gets the first property by the provided name or throws.

Gets the first property that matches the provided find function or throws.

Inserts a get accessor at the specified index.

Inserts get accessors at the specified index.

Inserts a method at the specified index.

insertMethods(index: number, structures: ReadonlyArray<OptionalKind<MethodDeclarationStructure>>): MethodDeclaration[]

Inserts methods at the specified index.

Inserts the specified properties to the object literal expression.

Note: If you only want to insert property assignments, then it might be more convenient to use #insertPropertyAssignments.

Inserts the specified property to the object literal expression.

Note: If you only want to insert a property assignment, then it might be more convenient to use #insertPropertyAssignment.

Inserts a property assignment at the specified index.

Inserts property assignments at the specified index.

Inserts a set accessor at the specified index.

Inserts set accessors at the specified index.

Inserts a shorthand property assignment at the specified index.

Inserts shorthand property assignments at the specified index.

Inserts a spread assignment at the specified index.

Inserts spread assignments at the specified index.