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

x/ts_morph/ts_morph.d.ts>EnumDeclaration

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

Methods

Adds a member to the enum.

Adds a member to the enum.

addMembers(structures: ReadonlyArray<OptionalKind<EnumMemberStructure>>): EnumMember[]

Adds members to the enum.

addMembers(structures: ReadonlyArray<OptionalKind<EnumMemberStructure> | WriterFunction | string> | string | WriterFunction): (EnumMember | CommentEnumMember)[]

Adds members to the enum.

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

Gets the const enum keyword or undefined if not exists.

getMember(name: string): EnumMember | undefined

Gets an enum member.

getMember(findFunction: (declaration: EnumMember) => boolean): EnumMember | undefined

Gets an enum member.

Gets an enum member or throws if not found.

getMemberOrThrow(findFunction: (declaration: EnumMember) => boolean): EnumMember

Gets an enum member or throws if not found.

Gets the enum's members.

Gets the enum's members with comment enum members.

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

Gets the structure equivalent to this node.

Inserts a member to the enum.

Inserts a member to the enum.

insertMembers(index: number, structures: ReadonlyArray<OptionalKind<EnumMemberStructure>>): EnumMember[]

Inserts members to an enum.

insertMembers(index: number, structures: ReadonlyArray<OptionalKind<EnumMemberStructure> | WriterFunction | string> | WriterFunction | string): (EnumMember | CommentEnumMember)[]

Inserts members to an enum.

isConstEnum(): boolean

Gets if it's a const enum.

set(structure: Partial<EnumDeclarationStructure>): this

Sets the node from a structure.

setIsConstEnum(value: boolean): this

Toggle if it's a const enum.