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

# TSConfig

> TypeScript configuration file specified in tsconfig.json, used for import resolution and computing dependencies.

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/ts_config.py#L21-L485" />

## Attributes

<HorizontalDivider />

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

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/typescript/TSConfig" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSConfig</a> <span>| None</span></> } description="Returns the base TSConfig that this config inherits from." />

### <span className="text-primary">base\_url</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 base URL defined in the TypeScript configuration." />

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

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">dict</code> } description="A dictionary containing the parsed configuration settings." />

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

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/File" style={ {fontWeight: "inherit", fontSize: "inherit"} }>File</a></> } description="The configuration file object representing the tsconfig.json file." />

### <span className="text-primary">config\_parser</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">TSConfigParser</code> } description="The parser used to interpret the TypeScript configuration." />

### <span className="text-primary">out\_dir</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 outDir defined in the TypeScript configuration." />

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

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">dict[str, list[str]]</code> } description="Returns a formatted version of the paths property from a TypeScript configuration file." />

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

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">dict[str, list[str]]</code> } description="Returns all custom module path mappings defined in the tsconfig file." />

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

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">dict[str, list[str]]</code> } description="Returns a formatted version of the references property from a TypeScript configuration file." />

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

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Directory" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Directory</a> <span>|</span> <a href="/api-reference/core/File" style={ {fontWeight: "inherit", fontSize: "inherit"} }>File</a> <span>]</span></> } description="Returns a list of directories that this TypeScript configuration file depends on." />

### <span className="text-primary">root\_dir</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 rootDir defined in the TypeScript configuration." />

### <span className="text-primary">root\_dirs</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">list[str]</code> } description="Returns the rootDirs defined in the TypeScript configuration." />

## Methods

<HorizontalDivider />

### <span className="text-primary">resolve\_base\_url</span>

Resolves an import path with the base url.

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

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

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

Translates an absolute path to an import path using the tsconfig paths.

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

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

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The translated import path." />

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

Translates an import path to an absolute path using the tsconfig paths.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/typescript/ts_config.py#L246-L304" />

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

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The translated absolute path. If no matching path alias is found, returns the original import path unchanged." />
