> ## Documentation Index
> Fetch the complete documentation index at: https://codegeninc-fix-system-prompt-typo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TSClass

> A class representing a TypeScript/JavaScript class with enhanced functionality for class manipulation. The TSClass provides comprehensive functionality for working with TypeScript/JavaScript classes, including handling class methods, attributes, JSX components, and inheritance relationships. It supports operations like adding source code to class bodies, managing class attributes, and handling React JSX components.

export const Attribute = ({type, description}) => <div className="pl-4 py-6 first:pt-3 dark:border-zinc-300/[0.06] text-sm font-normal">
    <div className="inline-grid grid-cols-[auto_auto] gap-1 font-mono py-2">
      {type}
    </div>
    <p className="mt-2">{description}</p>
  </div>;

export const GithubLinkNote = ({link}) => <Info>
      <div className="flex gap-2 items-center">View Source on <a target="_blank" rel="noopener noreferrer" href={link}>Github</a></div>
   </Info>;

export const HorizontalDivider = ({light = false}) => <div className="divide-y">
        <div className={`divide-y ${light ? "dark:border-zinc-300/[0.06]" : "border-zinc-600"}`}></div>
        <div className={`divide-y ${light ? "dark:border-zinc-300/[0.06]" : "border-zinc-600"}`}></div>
    </div>;

export const Return = ({return_type, description}) => <div className="pl-6 divide-y">
    <h4 className="font-bold">Returns</h4>
    <div className="dark:border-zinc-300/[0.06] ">
        <div className="py-6 first:pt-3 text-sm font-normal">
            <div className="flex gap-4 items-center">
                <div className="inline-grid grid-cols-[auto_auto] gap-1 font-mono py-2">
                    {return_type}
                </div>
            </div>
            <p className="mt-2">{description}</p>
        </div>
    </div>
  </div>;

export const ParameterWrapper = ({children}) => <div className="pl-6 divide-y">
    <h4 className="font-bold">Parameters</h4>
    <div className="divide-y dark:border-zinc-300/[0.06]">
      {children}
    </div>
  </div>;

export const Parameter = ({name, type, description, defaultValue}) => <div className="py-6 first:pt-3 dark:border-zinc-300/[0.06] text-sm font-normal">
    <div className="flex justify-between items-start font-mono">
      <div className="flex gap-4 items-start">
        <div className="flex gap-1 items-center text-sm text-primary mt-2">
          {name}
        </div>
        <div className="inline-grid grid-cols-[auto_auto] gap-1 py-2">
          {type}
        </div>
      </div>

      <div className="flex-shrink-0 mt-2">
        {defaultValue ? <div className="flex gap-1 items-center text-sm border border-purple-500 px-2 py-0.5 rounded">
            <span className="text-zinc-500">default:</span>
            <span className="text-purple-500">{defaultValue}</span>
          </div> : <span className="text-sm border border-purple-500 px-2 py-0.5 rounded">
            required
          </span>}
      </div>
    </div>
    <p className="mt-2">{description}</p>
  </div>;

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/class_definition.py#L34-L228" />

### Inherits from

[TSHasBlock](/api-reference/typescript/TSHasBlock), [TSSymbol](/api-reference/typescript/TSSymbol), [Class](/api-reference/core/Class), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName)

## Attributes

<HorizontalDivider />

### <span className="text-primary">call\_sites</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/FunctionCall" style={ {fontWeight: "inherit", fontSize: "inherit"} }>FunctionCall</a> <span>]</span></> } description="Returns all call sites (invocations) of this callable in the codebase." />

### <span className="text-primary">code\_block</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSCodeBlock" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSCodeBlock</a></> } description="The block of code associated with the code object." />

### <span className="text-primary">comment</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSCommentGroup" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSCommentGroup</a> <span>| None</span></> } description="Retrieves the comment group associated with the symbol." />

### <span className="text-primary">constructor</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSFunction" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFunction</a> <span>| None</span></> } description="Returns the constructor method for this class." />

### <span className="text-primary">decorators</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSDecorator" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSDecorator</a> <span>]</span></> } description="Returns a list of decorators associated with this symbol." />

### <span className="text-primary">docstring</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSCommentGroup" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSCommentGroup</a> <span>| None</span></> } description="Retrieves the docstring of a function or class." />

### <span className="text-primary">export</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>| None</span></> } description="Returns the export object that exports this symbol." />

### <span className="text-primary">exported\_name</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str | None</code> } description="Retrieves the exported name of a symbol from its file." />

### <span className="text-primary">extended</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/SymbolGroup" style={ {fontWeight: "inherit", fontSize: "inherit"} }>SymbolGroup</a></> } description="Returns a SymbolGroup of all extended nodes associated with this element." />

### <span className="text-primary">extended\_nodes</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="Returns the list of nodes associated with this symbol including extended nodes." />

### <span className="text-primary">extended\_source</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Returns the source text representation of all extended nodes." />

### <span className="text-primary">file</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSFile" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFile</a></> } description="The file object that this Editable instance belongs to." />

### <span className="text-primary">filepath</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The file path of the file that this Editable instance belongs to." />

### <span className="text-primary">full\_name</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str | None</code> } description="Returns the full name of the object, including the namespace path." />

### <span className="text-primary">function\_calls</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/FunctionCall" style={ {fontWeight: "inherit", fontSize: "inherit"} }>FunctionCall</a> <span>]</span></> } description="Returns all function calls within the code block and its decorators." />

### <span className="text-primary">has\_semicolon</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Checks whether the current symbol has a semicolon at the end." />

### <span className="text-primary">inline\_comment</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSCommentGroup" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSCommentGroup</a> <span>| None</span></> } description="Property that retrieves the inline comment group associated with the symbol." />

### <span className="text-primary">is\_decorated</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Checks if the current symbol has a decorator." />

### <span className="text-primary">is\_exported</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Indicates if the symbol is exported from its defining file." />

### <span className="text-primary">is\_jsx</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Determine if the class is a React JSX component." />

### <span className="text-primary">is\_reexported</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Determines if the symbol is re-exported from a different file." />

### <span className="text-primary">is\_subclass</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Indicates whether the current class is a subclass of another class." />

### <span className="text-primary">jsx\_elements</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/JSXElement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>JSXElement</a> <span>[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]]</span></> } description="Returns a list of all JSX elements contained within this symbol." />

### <span className="text-primary">name</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str | None</code> } description="Retrieves the base name of the object without namespace prefixes." />

### <span className="text-primary">nested\_classes</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]</span></> } description="Retrieves the nested classes defined within this class." />

### <span className="text-primary">parameters</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/SymbolGroup" style={ {fontWeight: "inherit", fontSize: "inherit"} }>SymbolGroup</a> <span>[</span> <a href="/api-reference/typescript/TSParameter" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSParameter</a> <span>,</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>] | list[</span> <a href="/api-reference/typescript/TSParameter" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSParameter</a> <span>]</span></> } description="Retrieves all parameters of a callable symbol." />

### <span className="text-primary">parent</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a></> } description="The parent node of this Editable instance." />

### <span className="text-primary">parent\_class</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>| None</span></> } description="Find the class this node is contained in" />

### <span className="text-primary">parent\_class\_names</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Name" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Name</a> <span>|</span> <a href="/api-reference/typescript/TSChainedAttribute" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSChainedAttribute</a> <span>]</span></> } description="Returns a list of the parent class names that this class inherits from." />

### <span className="text-primary">parent\_classes</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>Parents[</span> <a href="/api-reference/core/Type" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Type</a> <span>,</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>] | None</span></> } description="The parent classes of this class, if any." />

### <span className="text-primary">parent\_function</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSFunction" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFunction</a> <span>| None</span></> } description="Find the function this node is contained in" />

### <span className="text-primary">parent\_statement</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Statement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Statement</a> <span>| None</span></> } description="Find the statement this node is contained in" />

### <span className="text-primary">resolved\_value</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Expression" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Expression</a> <span>| list[</span> <a href="/api-reference/core/Expression" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Expression</a> <span>]</span></> } description="Returns the resolved type of an Expression." />

### <span className="text-primary">return\_type</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Type" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Type</a> <span>|</span> <a href="/api-reference/core/Placeholder" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Placeholder</a> <span>[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]</span></> } description="The type of value returned by the callable, or a placeholder." />

### <span className="text-primary">semicolon\_node</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| None</span></> } description="Retrieves the semicolon node associated with a TypeScript symbol." />

### <span className="text-primary">source</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Returns the source code of the symbol." />

### <span className="text-primary">symbol\_type</span>

<HorizontalDivider light={true} />

<Attribute type={ <span></span> } description="The type of symbol, set to SymbolType.Class." />

### <span className="text-primary">type\_parameters</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>TypeParameters[</span> <a href="/api-reference/core/Type" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Type</a> <span>,</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>] | None</span></> } description="The type parameters of the symbol, if any." />

### <span className="text-primary">variable\_usages</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" />

## Methods

<HorizontalDivider />

### <span className="text-primary">add\_attribute</span>

Adds an attribute to a class from another class.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L360-L383" />

<ParameterWrapper>
  <Parameter name="attribute" type={ <><a href="/api-reference/typescript/TSAttribute" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSAttribute</a></> } description="The attribute to add to the class." defaultValue="" />

  <Parameter name="include_dependencies" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to include the attribute's dependencies. If True, adds any necessary imports to the class's file. Defaults to False." defaultValue="False" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">add\_attribute\_from\_source</span>

Adds a class attribute from source code to a TypeScript/JavaScript class.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/class_definition.py#L151-L174" />

<ParameterWrapper>
  <Parameter name="source" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The source code of the attribute to add to the class." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">add\_comment</span>

Adds a new comment to the symbol.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/symbol.py#L164-L190" />

<ParameterWrapper>
  <Parameter name="comment" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The comment text to be added." defaultValue="" />

  <Parameter name="auto_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to automatically format the text into a comment style. Defaults to True." defaultValue="True" />

  <Parameter name="clean_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to clean the format of the comment before inserting. Defaults to True." defaultValue="True" />

  <Parameter name="comment_type" type={ <><a href="/api-reference/typescript/TSCommentType" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSCommentType</a></> } description="Type of comment to add. Defaults to TSCommentType.DOUBLE_SLASH." defaultValue="TSCommentType.DOUBLE_SLASH" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">add\_decorator</span>

Adds a decorator to a function or method.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_block.py#L97-L119" />

<ParameterWrapper>
  <Parameter name="new_decorator" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The decorator to add, including the '@' symbol." defaultValue="" />

  <Parameter name="skip_if_exists" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="If True, skips adding if the decorator exists." defaultValue="False" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="True if the decorator was added, False if skipped." />

### <span className="text-primary">add\_keyword</span>

Insert a keyword in the appropriate place before this symbol if it doesn't already exist.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/symbol.py#L409-L433" />

<ParameterWrapper>
  <Parameter name="keyword" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The keyword to be inserted. Must be a valid keyword in the language context." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">add\_source</span>

Adds source code to a class body.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/class_definition.py#L135-L148" />

<ParameterWrapper>
  <Parameter name="source" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The source code to be added to the class body." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">ancestors</span>

Find all ancestors of the node of the given type. Does not return itself

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1119-L1127" />

<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="" />

### <span className="text-primary">attributes</span>

Retrieves all attributes from this Class including those from its superclasses up to a

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L274-L293" />

<ParameterWrapper>
  <Parameter name="max_depth" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int | None</code> } description="The maximum depth of superclass traversal. None means no limit, 0 means only this class." defaultValue="0" />

  <Parameter name="private" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to include private attributes. Defaults to True." defaultValue="True" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/typescript/TSAttribute" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSAttribute</a> <span>]</span></> } description="A list of unique attributes from this class and its superclasses. If an attribute is defined in multiple classes, the first definition encountered is used." />

### <span className="text-primary">class\_component\_to\_function\_component</span>

Converts a class component to a function component.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/class_definition.py#L226-L228" />

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">convert\_props\_to\_interface</span>

Converts React component props to TypeScript interfaces.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/class_definition.py#L176-L223" />

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">dependencies</span>

Returns a list of symbols that this symbol depends on.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/importable.py#L46-L78" />

<ParameterWrapper>
  <Parameter name="usage_types" type={ <><a href="/api-reference/core/UsageType" style={ {fontWeight: "inherit", fontSize: "inherit"} }>UsageType</a> <span>| None</span></> } description="The types of dependencies to search for. Defaults to UsageType.DIRECT." defaultValue="UsageType.DIRECT" />

  <Parameter name="max_depth" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int | None</code> } description="Maximum depth to traverse in the dependency graph. If provided, will recursively collect" defaultValue="None" />
</ParameterWrapper>

<Return return_type={ <><span>list[Union[</span> <a href="/api-reference/typescript/TSSymbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSSymbol</a> <span>,</span> <a href="/api-reference/typescript/TSImport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSImport</a> <span>]]</span></> } description="A list of symbols and imports that this symbol depends on, sorted by file location." />

### <span className="text-primary">edit</span>

Replace the source of this node with new\_src.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/symbol.py#L124-L139" />

<ParameterWrapper>
  <Parameter name="new_src" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The new source code to replace the current source with." defaultValue="" />

  <Parameter name="fix_indentation" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="If True, adjusts the indentation of new_src to match the current text's indentation. Defaults to False." defaultValue="False" />

  <Parameter name="priority" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int</code> } description="The priority of this edit. Higher priority edits take precedence. Defaults to 0." defaultValue="0" />

  <Parameter name="dedupe" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="If True, prevents duplicate edits. Defaults to True." defaultValue="True" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">find</span>

Find and return matching nodes or substrings within an Editable instance.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L487-L504" />

<ParameterWrapper>
  <Parameter name="strings_to_match" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">Union[list[str], str]</code> } description="One or more strings to search for." defaultValue="" />

  <Parameter name="exact" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="If True, only return nodes whose source exactly matches one of the strings_to_match." defaultValue="False" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="A list of Editable instances that match the search criteria." />

### <span className="text-primary">find\_string\_literals</span>

Returns a list of string literals within this node's source that match any of the given

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L398-L412" />

<ParameterWrapper>
  <Parameter name="strings_to_match" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">list[str]</code> } description="A list of strings to search for in string literals." defaultValue="" />

  <Parameter name="fuzzy_match" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="If True, matches substrings within string literals. If False, only matches exact strings. Defaults to False." defaultValue="False" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]]</span></> } description="A list of Editable objects representing the matching string literals." />

### <span className="text-primary">flag</span>

Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/symbol.py#L494-L514" />

<Return return_type={ <><span>CodeFlag[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]</span></> } description="The code flag object for tracking purposes" />

### <span className="text-primary">get\_attribute</span>

Returns a specific attribute by name.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L296-L313" />

<ParameterWrapper>
  <Parameter name="name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The name of the attribute to search for." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSAttribute" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSAttribute</a> <span>| None</span></> } description="The matching attribute if found, None otherwise. If multiple attributes with the same name exist in the inheritance hierarchy, returns the first one found." />

### <span className="text-primary">get\_component</span>

Returns a specific JSX element from within this symbol's JSX elements.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/interfaces/has_block.py#L90-L105" />

<ParameterWrapper>
  <Parameter name="component_name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The name of the JSX component to find." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/JSXElement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>JSXElement</a> <span>[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>] | None</span></> } description="The matching JSX element if found, None otherwise." />

### <span className="text-primary">get\_import\_string</span>

Generates the appropriate import string for a symbol.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/symbol.py#L49-L75" />

<ParameterWrapper>
  <Parameter name="alias" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str | None, optional</code> } description="The alias to use for the imported symbol. Defaults to None." defaultValue="None" />

  <Parameter name="module" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str | None, optional</code> } description="The module to import from. If None, uses the file's import module name." defaultValue="None" />

  <Parameter name="import_type" type={ <><a href="/api-reference/core/ImportType" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ImportType</a> <span>, optional</span></> } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" />

  <Parameter name="is_type_import" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether this is a type-only import. Defaults to False." defaultValue="False" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="A formatted import statement string." />

### <span className="text-primary">get\_method</span>

Returns a specific method by name from the class or any of its superclasses.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L253-L270" />

<ParameterWrapper>
  <Parameter name="name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The name of the method to find." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSFunction" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFunction</a> <span>| None</span></> } description="The method if found, None otherwise." />

### <span className="text-primary">get\_name</span>

Returns the name node of the object.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_name.py#L52-L62" />

<Return return_type={ <><a href="/api-reference/core/Name" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Name</a> <span>|</span> <a href="/api-reference/typescript/TSChainedAttribute" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSChainedAttribute</a> <span>| None</span></> } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name." />

### <span className="text-primary">get\_nested\_class</span>

Returns a nested class by name from the current class.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L236-L250" />

<ParameterWrapper>
  <Parameter name="name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The name of the nested class to find." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>| None</span></> } description="The nested class if found, None otherwise." />

### <span className="text-primary">get\_parameter</span>

Gets a specific parameter from the callable's parameters list by name.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/callable.py#L90-L99" />

<ParameterWrapper>
  <Parameter name="name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The name of the parameter to retrieve." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSParameter" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSParameter</a> <span>| None</span></> } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters." />

### <span className="text-primary">get\_parameter\_by\_index</span>

Returns the parameter at the given index.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/callable.py#L102-L114" />

<ParameterWrapper>
  <Parameter name="index" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int</code> } description="The index of the parameter to retrieve." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSParameter" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSParameter</a> <span>| None</span></> } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist." />

### <span className="text-primary">get\_parameter\_by\_type</span>

Retrieves a parameter from the callable by its type.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/callable.py#L117-L130" />

<ParameterWrapper>
  <Parameter name="type" type={ <><a href="/api-reference/typescript/TSSymbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSSymbol</a></> } description="The type to search for." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSParameter" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSParameter</a> <span>| None</span></> } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters." />

### <span className="text-primary">get\_parent\_class</span>

Returns the parent class node with the specified name.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L113-L125" />

<ParameterWrapper>
  <Parameter name="parent_class_name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The name of the parent class to find." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| None</span></> } description="The matching parent class node, or None if no match is found." />

### <span className="text-primary">get\_variable\_usages</span>

Returns Editables for all TreeSitter nodes corresponding to instances of variable usage

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L909-L925" />

<ParameterWrapper>
  <Parameter name="var_name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The variable name to search for." defaultValue="" />

  <Parameter name="fuzzy_match" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="If True, matches variables where var_name is a substring. If False, requires exact match. Defaults to False." defaultValue="False" />
</ParameterWrapper>

<Return return_type={ <><span>Sequence[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]]</span></> } description="List of Editable objects representing variable usage nodes matching the given name." />

### <span className="text-primary">insert\_after</span>

Inserts code after this node.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L608-L634" />

<ParameterWrapper>
  <Parameter name="new_src" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The source code to insert after this node." defaultValue="" />

  <Parameter name="fix_indentation" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to adjust the indentation of new_src to match the current node. Defaults to False." defaultValue="False" />

  <Parameter name="newline" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to add a newline before the new_src. Defaults to True." defaultValue="True" />

  <Parameter name="priority" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int, optional</code> } description="Priority of the insertion transaction. Defaults to 0." defaultValue="0" />

  <Parameter name="dedupe" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to deduplicate identical transactions. Defaults to True." defaultValue="True" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">insert\_before</span>

Inserts text before the current symbol node in the Abstract Syntax Tree.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/symbol.py#L243-L267" />

<ParameterWrapper>
  <Parameter name="new_src" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The source code text to insert." defaultValue="" />

  <Parameter name="fix_indentation" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to adjust the indentation of new_src to match current text. Defaults to False." defaultValue="False" />

  <Parameter name="newline" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to add a newline after insertion. Defaults to True." defaultValue="True" />

  <Parameter name="priority" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int</code> } description="Priority of this edit operation. Higher priority edits are applied first. Defaults to 0." defaultValue="0" />

  <Parameter name="dedupe" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to remove duplicate insertions. Defaults to True." defaultValue="True" />

  <Parameter name="extended" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to insert before extended nodes like comments and decorators. Defaults to True." defaultValue="True" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">is\_child\_of</span>

Checks if this node is a descendant of the given editable instance in the AST.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1109-L1116" />

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="" />

### <span className="text-primary">is\_subclass\_of</span>

Checks if the class inherits from a specified parent class.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L140-L154" />

<ParameterWrapper>
  <Parameter name="parent_class" type={ <><span>str |</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a></> } description="The parent class to check for. Can be specified either as a class name string or Class object." defaultValue="" />

  <Parameter name="max_depth" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int | None</code> } description="Maximum inheritance depth to search. None means no limit." defaultValue="None" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="True if this class inherits from the parent class, False otherwise." />

### <span className="text-primary">is\_wrapped\_in</span>

Check if this node is contained another node of the given class

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1088-L1090" />

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="" />

### <span className="text-primary">methods</span>

Retrieves all methods that exist on this Class, including methods from superclasses, with

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L205-L233" />

<ParameterWrapper>
  <Parameter name="max_depth" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int | None, optional</code> } description="Include parent classes up to max_depth. None means no limit, 0 means only current class. Defaults to 0." defaultValue="0" />

  <Parameter name="private" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to include private methods. Defaults to True." defaultValue="True" />

  <Parameter name="magic" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to include magic methods. Defaults to False." defaultValue="True" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/typescript/TSFunction" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFunction</a> <span>] |</span> <a href="/api-reference/core/MultiLineCollection" style={ {fontWeight: "inherit", fontSize: "inherit"} }>MultiLineCollection</a> <span>[</span> <a href="/api-reference/typescript/TSFunction" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFunction</a> <span>,</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]</span></> } description="" />

### <span className="text-primary">move\_to\_file</span>

Moves the given symbol to a new file and updates its imports and references.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/symbol.py#L269-L293" />

<ParameterWrapper>
  <Parameter name="file" type={ <><a href="/api-reference/typescript/TSFile" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFile</a></> } description="The destination file to move the symbol to." defaultValue="" />

  <Parameter name="include_dependencies" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="If True, moves all dependencies of the symbol to the new file. If False, adds imports for the dependencies. Defaults to True." defaultValue="True" />

  <Parameter name="strategy" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The strategy to use for updating imports. Can be either 'add_back_edge' or 'update_all_imports'. Defaults to 'update_all_imports'." defaultValue="&#x22;update_all_imports&#x22;" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">parent\_of\_type</span>

Find the first ancestor of the node of the given type. Does not return itself

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1093-L1099" />

<Return return_type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| None</span></> } description="" />

### <span className="text-primary">parent\_of\_types</span>

Find the first ancestor of the node of the given type. Does not return itself

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1101-L1107" />

<Return return_type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| None</span></> } description="" />

### <span className="text-primary">reduce\_condition</span>

Reduces an editable to the following condition

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1044-L1049" />

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">remove</span>

Deletes this Node and its related extended nodes (e.g. decorators, comments).

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L687-L702" />

<ParameterWrapper>
  <Parameter name="delete_formatting" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to delete surrounding whitespace and formatting. Defaults to True." defaultValue="True" />

  <Parameter name="priority" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int</code> } description="Priority of the removal transaction. Higher priority transactions are executed first. Defaults to 0." defaultValue="0" />

  <Parameter name="dedupe" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to deduplicate removal transactions at the same location. Defaults to True." defaultValue="True" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">rename</span>

Renames a symbol and updates all its references in the codebase.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/usable.py#L78-L91" />

<ParameterWrapper>
  <Parameter name="new_name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The new name for the symbol." defaultValue="" />

  <Parameter name="priority" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int</code> } description="Priority of the edit operation. Defaults to 0." defaultValue="0" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">tuple[NodeId, NodeId]</code> } description="A tuple containing the file node ID and the new node ID of the renamed symbol." />

### <span className="text-primary">replace</span>

Search and replace occurrences of text within this node's source and its extended nodes.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L432-L456" />

<ParameterWrapper>
  <Parameter name="old" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The text or pattern to search for." defaultValue="" />

  <Parameter name="new" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The text to replace matches with." defaultValue="" />

  <Parameter name="count" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int, optional</code> } description="Maximum number of replacements to make. Defaults to -1 (replace all)." defaultValue="-1" />

  <Parameter name="is_regex" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to treat 'old' as a regex pattern. Defaults to False." defaultValue="False" />

  <Parameter name="priority" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int, optional</code> } description="Priority of the replacement operation. Defaults to 0." defaultValue="0" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int</code> } description="The total number of replacements made." />

### <span className="text-primary">search</span>

Returns a list of all regex match of `regex_pattern`, similar to python's re.search().

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L520-L536" />

<ParameterWrapper>
  <Parameter name="regex_pattern" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The regular expression pattern to search for." defaultValue="" />

  <Parameter name="include_strings" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="When False, excludes the contents of string literals from the search. Defaults to True." defaultValue="True" />

  <Parameter name="include_comments" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="When False, excludes the contents of comments from the search. Defaults to True." defaultValue="True" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="A list of Editable objects corresponding to the matches found." />

### <span className="text-primary">set\_comment</span>

Sets a comment to the symbol.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/symbol.py#L128-L161" />

<ParameterWrapper>
  <Parameter name="comment" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The comment text to be added." defaultValue="" />

  <Parameter name="auto_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to automatically format the text into a comment syntax." defaultValue="True" />

  <Parameter name="clean_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to clean the format of the comment before inserting." defaultValue="True" />

  <Parameter name="comment_type" type={ <><a href="/api-reference/typescript/TSCommentType" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSCommentType</a> <span>, optional</span></> } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">set\_docstring</span>

Sets or updates a docstring for a code element.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/interfaces/has_block.py#L138-L172" />

<ParameterWrapper>
  <Parameter name="docstring" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The docstring text to be added or updated." defaultValue="" />

  <Parameter name="auto_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to automatically format the text into a docstring format. Defaults to True." defaultValue="True" />

  <Parameter name="clean_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to clean existing formatting from the docstring before inserting. Defaults to True." defaultValue="True" />

  <Parameter name="leading_star" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to add leading &#x22;*&#x22; to each line of the comment block. Defaults to True." defaultValue="True" />

  <Parameter name="force_multiline" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to force single line comments to be multi-line. Defaults to False." defaultValue="False" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">set\_inline\_comment</span>

Sets an inline comment to the symbol.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/symbol.py#L193-L227" />

<ParameterWrapper>
  <Parameter name="comment" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The inline comment text to be added." defaultValue="" />

  <Parameter name="auto_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to automatically format the text as a comment." defaultValue="True" />

  <Parameter name="clean_format" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool, optional</code> } description="Whether to clean the comment format before inserting." defaultValue="True" />

  <Parameter name="node" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">TSNode | None, optional</code> } description="The specific node to attach the comment to." defaultValue="None" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">set\_name</span>

Sets the name of a code element.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_name.py#L65-L77" />

<ParameterWrapper>
  <Parameter name="name" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The new name to set for the object." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="" />

### <span className="text-primary">subclasses</span>

Returns all classes which subclass this class.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L158-L169" />

<ParameterWrapper>
  <Parameter name="max_depth" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int | None, optional</code> } description="Maximum inheritance depth to search. If None, searches all depths. Defaults to None." defaultValue="None" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>]</span></> } description="A list of Class objects that inherit from this class." />

### <span className="text-primary">superclasses</span>

Returns a list of all classes that this class extends, up to max\_depth.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/class_definition.py#L79-L95" />

<ParameterWrapper>
  <Parameter name="max_depth" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int | None</code> } description="The maximum depth to traverse up the inheritance tree. If None, traverses the entire tree." defaultValue="None" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/typescript/TSClass" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSClass</a> <span>|</span> <a href="/api-reference/core/ExternalModule" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ExternalModule</a> <span>|</span> <a href="/api-reference/typescript/TSInterface" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSInterface</a> <span>]</span></> } description="A list of all superclass symbols in MRO order, up to max_depth. Returns an empty list if the class has no parent classes." />

### <span className="text-primary">symbol\_usages</span>

Returns a list of symbols that use or import the exportable object.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/usable.py#L27-L42" />

<ParameterWrapper>
  <Parameter name="usage_types" type={ <><a href="/api-reference/core/UsageType" style={ {fontWeight: "inherit", fontSize: "inherit"} }>UsageType</a> <span>| None</span></> } description="The types of usages to search for. Defaults to any." defaultValue="None" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/typescript/TSImport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSImport</a> <span>|</span> <a href="/api-reference/typescript/TSSymbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSSymbol</a> <span>|</span> <a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>]</span></> } description="A list of symbols that use or import the exportable object." />

### <span className="text-primary">usages</span>

Returns a list of usages of the exportable object.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/usable.py#L46-L76" />

<ParameterWrapper>
  <Parameter name="usage_types" type={ <><a href="/api-reference/core/UsageType" style={ {fontWeight: "inherit", fontSize: "inherit"} }>UsageType</a> <span>| None</span></> } description="Specifies which types of usages to include in the results. Default is any usages." defaultValue="None" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Usage" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Usage</a> <span>]</span></> } description="A sorted list of Usage objects representing where this exportable is used, ordered by source location in reverse." />
