> ## Documentation Index
> Fetch the complete documentation index at: https://codegeninc-jay-docs-fixes-24.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TSFile

> Extends the SourceFile class to provide TypeScript-specific functionality.

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-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L32-L439" />

### Inherits from

[Exportable](/api-reference/core/Exportable), [TSHasBlock](/api-reference/typescript/TSHasBlock), [SourceFile](/api-reference/core/SourceFile), [Usable](/api-reference/core/Usable), [HasBlock](/api-reference/core/HasBlock), [File](/api-reference/core/File), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName)

## Attributes

<HorizontalDivider />

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Class" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Class</a> <span>]</span></> } description="Returns all Classes in the file." />

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

<HorizontalDivider light={true} />

<Attribute
  type={ <><a href="/api-reference/core/CodeBlock" style={ {fontWeight: "inherit", fontSize: "inherit"} }>CodeBlock</a></> }
  description="
"
/>

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

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Returns the content of the file as a UTF-8 encoded string." />

### <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">default\_exports</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>]</span></> } description="Returns all default export symbols from the file." />

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[Union[</span> <a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>,</span> <a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>]]</span></> } description="Returns a list of symbols that this symbol depends on." />

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

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Directory" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Directory</a> <span>| None</span></> } description="Returns the directory that contains this file." />

### <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/core/Export" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Export</a> <span>| None</span></> } description="Returns the export object that exports this symbol." />

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/ExportStatement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ExportStatement</a> <span>[</span> <a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>]]</span></> } description="Returns a list of all export statements in the file." />

### <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">exports</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>]</span></> } description="Returns all Export symbols in the 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\_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">extension</span>

<HorizontalDivider light={true} />

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

### <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="A property that returns the file object for non-source files." />

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

<HorizontalDivider light={true} />

<Attribute
  type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">NodeId</code> }
  description="
"
/>

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

<HorizontalDivider light={true} />

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

### <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="Retrieves 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">functions</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Function" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Function</a> <span>]</span></> } description="Returns all Functions in the file." />

### <span className="text-primary">global\_vars</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Assignment" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Assignment</a> <span>]</span></> } description="Returns all GlobalVars in the file." />

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

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Returns the module name that this file gets imported as." />

### <span className="text-primary">import\_statements</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/ImportStatement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ImportStatement</a> <span>]</span></> } description="Returns all ImportStatements in the file, where each import statement can contain" />

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>]</span></> } description="Returns all imports that directly imports this file as a module." />

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>]</span></> } description="List of all Imports in this file." />

### <span className="text-primary">inbound\_imports</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>]</span></> } description="Returns all imports that are importing symbols contained in this file." />

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSInterface" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSInterface</a> <span>]</span></> } description="Returns all Interfaces in the file." />

### <span className="text-primary">is\_binary</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 file contains binary data." />

### <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\_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">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/TSFile" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFile</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">named\_exports</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>]</span></> } description="Returns the named exports declared in the file." />

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

<HorizontalDivider light={true} />

<Attribute
  type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">Literal[NodeType.FILE]</code> }
  description="
"
/>

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

<HorizontalDivider light={true} />

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

### <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="
"
/>

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

<HorizontalDivider light={true} />

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

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

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Function" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Function</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">path</span>

<HorizontalDivider light={true} />

<Attribute
  type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">Path</code> }
  description="
"
/>

### <span className="text-primary">programming\_language</span>

<HorizontalDivider light={true} />

<Attribute
  type={ <span></span> }
  description="
"
/>

### <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">source</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Text representation of the Editable instance." />

### <span className="text-primary">start\_byte</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int</code> } description="Returns the starting byte position of a file in its content." />

### <span className="text-primary">symbols\_sorted\_topologically</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>]</span></> } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" />

### <span className="text-primary">ts\_config</span>

<HorizontalDivider light={true} />

<Attribute
  type={ <><a href="/api-reference/typescript/TSConfig" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSConfig</a> <span>| None</span></> }
  description="
"
/>

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

<HorizontalDivider light={true} />

<Attribute
  type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">TSNode</code> }
  description="
"
/>

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSTypeAlias" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSTypeAlias</a> <span>]</span></> } description="Returns all type aliases in the file." />

### <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\_decorator</span>

Adds a decorator to a function or method.

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

<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\_export\_to\_symbol</span>

Adds an export keyword to a symbol in a TypeScript file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L206-L219" />

<ParameterWrapper>
  <Parameter name="symbol" type={ <><a href="/api-reference/typescript/TSSymbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSSymbol</a></> } description="The TypeScript symbol (function, class, interface, etc.) to be exported." 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\_import\_from\_import\_string</span>

Adds import to the file from a string representation of an import statement.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L910-L934" />

<ParameterWrapper>
  <Parameter name="import_string" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The string representation of the import statement to add." 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\_symbol</span>

Adds `symbol` to the file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L957-L987" />

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

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

<Return return_type={ <><a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>| None</span></> } description="The existing symbol if it already exists in the file or None if it was added." />

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

Adds a symbol to a file from a string representation.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L937-L954" />

<ParameterWrapper>
  <Parameter name="source" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="String representation of the symbol to be added. This should be valid source code for" defaultValue="" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description="The symbol is added directly to the file's content." />

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

Adds an import to a file for a given symbol.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L880-L907" />

<ParameterWrapper>
  <Parameter name="symbol" type={ <><a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a></> } description="The symbol to import." defaultValue="" />

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

  <Parameter name="import_type" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">ImportType</code> } description="The type of import to use. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" />

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

<Return return_type={ <><a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>| None</span></> } description="The existing import for the symbol or None if it was added." />

### <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-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1082-L1090" />

<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">edit</span>

Replace the source of this `Editable` with `new_src`.

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

<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 text to replace the current text 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 level. 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 the edit transaction. 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="If True, deduplicates 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">find</span>

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

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

<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\_by\_byte\_range</span>

Finds all editable objects that overlap with the given byte range in the file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L1083-L1095" />

<ParameterWrapper>
  <Parameter name="range" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">Range</code> } description="The byte range to search within the file." defaultValue="" />
</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 all Editable objects that overlap with the given range." />

### <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-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L388-L402" />

<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></> } description="A list of Editable objects representing the matching string literals." />

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

Adds a visual flag comment to the end of this Editable's source text.

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

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

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

Returns a specific Class by full name. Returns None if not found.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L748-L761" />

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

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

### <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-sdk/blob/develop/src/codegen/sdk/typescript/interfaces/has_block.py#L89-L104" />

<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/TSFile" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSFile</a> <span>] | None</span></> } description="The matching JSX element if found, None otherwise." />

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

Returns the nearest tsconfig.json applicable to this file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L195-L203" />

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

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

Returns an export object with the specified name from the file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L99-L110" />

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

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

### <span className="text-primary">get\_export\_statement\_for\_path</span>

Gets the first export of specified type that contains the given path in single or double quotes.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L326-L348" />

<ParameterWrapper>
  <Parameter name="relative_path" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The path to check for in export statements" defaultValue="" />

  <Parameter name="export_type" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Type of export to get - &#x22;WILDCARD&#x22;, &#x22;TYPE&#x22;, or &#x22;EXPORT&#x22; (default)" defaultValue="&#x22;EXPORT&#x22;" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/core/ExportStatement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ExportStatement</a> <span>| None</span></> } description="The first matching export if found, None otherwise." />

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

Returns a list of file extensions that this class can parse.

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

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">list[str]</code> } description="A list of file extensions including '.tsx', '.ts', '.jsx', and '.js'." />

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

Returns a specific Function by name.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L777-L788" />

<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 function to find." defaultValue="" />
</ParameterWrapper>

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

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

Returns a specific global var by name. Returns None if not found.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L723-L732" />

<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 global variable to find." defaultValue="" />
</ParameterWrapper>

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

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

Returns the import with matching alias. Returns None if not found.

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

<ParameterWrapper>
  <Parameter name="symbol_alias" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The alias name to search for. This can match either the direct import name or the aliased name." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>| None</span></> } description="The import statement with the matching alias if found, None otherwise." />

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

Generates and returns an import statement for the file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L365-L381" />

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

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

  <Parameter name="import_type" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">ImportType</code> } description="The type of import statement. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" />

  <Parameter name="is_type_import" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</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 importing all exports from the module." />

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

Retrieves a specific interface from the file by its name.

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

<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 interface to find." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSInterface" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSInterface</a> <span>| None</span></> } description="The interface with the specified name 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-sdk/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/core/ChainedAttribute" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ChainedAttribute</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\_namespace</span>

Returns a specific namespace by name from the file's namespaces.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L430-L439" />

<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 namespace to find." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSNamespace" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSNamespace</a> <span>| None</span></> } description="The namespace with the specified name if found, None otherwise." />

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

Gets a symbol by its name from the file.

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

<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 symbol to find." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>| None</span></> } description="The found symbol, or None if not found." />

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

Returns a specific Type by name from the file's types.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L152-L163" />

<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 type alias to retrieve." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><a href="/api-reference/typescript/TSTypeAlias" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSTypeAlias</a> <span>| None</span></> } description="The TypeScript type alias with the matching name, or None if not 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-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L896-L912" />

<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>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="List of Editable objects representing variable usage nodes matching the given name." />

### <span className="text-primary">has\_export\_statement\_for\_path</span>

Checks if the file has exports of specified type that contains the given path in single or double quotes.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L302-L319" />

<ParameterWrapper>
  <Parameter name="relative_path" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The path to check for in export statements" defaultValue="" />

  <Parameter name="export_type" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Type of export to check for - &#x22;WILDCARD&#x22;, &#x22;TYPE&#x22;, or &#x22;EXPORT&#x22; (default)" defaultValue="&#x22;EXPORT&#x22;" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="True if there exists an export of specified type with the exact relative path (quoted) in its source, False otherwise." />

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

Returns True if the file has an import with the given alias.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L619-L631" />

<ParameterWrapper>
  <Parameter name="symbol_alias" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The alias to check for in the import statements." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="True if an import with the given alias exists, False otherwise." />

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

Inserts code after this node.

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

<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 this node's source with optional indentation and newline handling.

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

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

  <Parameter name="fix_indentation" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="Whether to fix 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</code> } description="Whether to add a newline after 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</code> } description="Transaction priority for managing multiple edits. 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 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">is\_wrapped\_in</span>

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

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

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</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-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1073-L1079" />

<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-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1024-L1029" />

<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>

Removes the file from the file system and graph.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L254-L266" />

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

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

Removes unused exports from the file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L234-L288" />

<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-sdk/blob/develop/src/codegen/sdk/core/interfaces/usable.py#L77-L90" />

<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-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L421-L445" />

<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-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L509-L525" />

<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\_docstring</span>

Sets or updates a docstring for a code element.

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

<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\_name</span>

Sets the name of a code element.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/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">symbol\_can\_be\_added</span>

Determines if a TypeScript symbol can be added to this file based on its type and JSX compatibility.

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

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

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description="True if the symbol can be added to this file, False otherwise." />

### <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-sdk/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/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>|</span> <a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>|</span> <a href="/api-reference/core/Export" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Export</a> <span>]</span></> } description="A list of symbols that use or import the exportable object." />

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

Returns all Symbols in the file, sorted by position in the file.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/file.py#L646-L660" />

<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>|</span> <a href="/api-reference/core/Class" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Class</a> <span>|</span> <a href="/api-reference/core/Function" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Function</a> <span>|</span> <a href="/api-reference/core/Assignment" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Assignment</a> <span>| TInterface]</span></> } description="A list of all top-level symbols in the file, sorted by their position in the file. Symbols can be one of the following types: - Symbol: Base symbol class - TClass: Class definition - TFunction: Function definition - TGlobalVar: Global variable assignment - TInterface: Interface definition" />

### <span className="text-primary">update\_filepath</span>

Updates the file path of the current file and all associated imports.

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/typescript/file.py#L401-L427" />

<ParameterWrapper>
  <Parameter name="new_filepath" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The new file path to move the file to." 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">usages</span>

Returns a list of usages of the exportable object.

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

<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." />
