# `orchestrator.pkg.typescript_extractor`
<!-- generated by `orchestrator understand`; the PKG is source of truth, edits here are advisory -->

[← Episteme](../README.md) · [Architecture](../architecture.md)

**Source:** [`src/orchestrator/pkg/typescript_extractor.py`](../../src/orchestrator/pkg/typescript_extractor.py)

1 types · 16 functions · python

## Changing this safely

**Tested by** (1): `tests.pkg.test_typescript_extractor`

**Most depended-upon here** — a change to these reaches the most code (call graph, ≤4 hops):

- [`_text`](../../src/orchestrator/pkg/typescript_extractor.py#L562) — reaches **13** symbols · **no test path visible**
- [`TypeScriptExtractor`](../../src/orchestrator/pkg/typescript_extractor.py#L46) — reaches **6** symbols
- [`_import_target`](../../src/orchestrator/pkg/typescript_extractor.py#L287) — reaches **5** symbols · **no test path visible**
- [`_field_text`](../../src/orchestrator/pkg/typescript_extractor.py#L557) — reaches **4** symbols · **no test path visible**
- [`_pattern_names`](../../src/orchestrator/pkg/typescript_extractor.py#L349) — reaches **4** symbols · **no test path visible**
- [`_ts_parser`](../../src/orchestrator/pkg/typescript_extractor.py#L568) — reaches **4** symbols
- [`_ensure_external`](../../src/orchestrator/pkg/typescript_extractor.py#L243) — reaches **3** symbols · **no test path visible**
- [`_params_of`](../../src/orchestrator/pkg/typescript_extractor.py#L370) — reaches **3** symbols · **no test path visible**

_15 of the symbols other code depends on here have no test path the graph can see — worth a second look before changing them. Absence of a path is not proof of absence of a test: calls through an attribute chain (`obj.method()`) are skipped rather than guessed at, so indirect coverage is invisible._

## Types

### `TypeScriptExtractor`

[`src/orchestrator/pkg/typescript_extractor.py:46`](../../src/orchestrator/pkg/typescript_extractor.py#L46)

- **Called by** (1 production · 8 test): [`default_extractors`](../../src/orchestrator/pkg/extractor.py#L530), [`_facts`](../../tests/pkg/test_typescript_extractor.py#L50), [`test_method_call_on_a_named_import_is_not_a_module_member`](../../tests/pkg/test_typescript_extractor.py#L204), [`test_namespace_import_member_call_still_resolves`](../../tests/pkg/test_typescript_extractor.py#L223), [`test_package_base_type_gets_an_external_node`](../../tests/pkg/test_typescript_extractor.py#L185), [`test_package_call_target_gets_an_external_node`](../../tests/pkg/test_typescript_extractor.py#L168), [`test_relative_import_joins_to_the_first_party_module`](../../tests/pkg/test_typescript_extractor.py#L235), [`test_repo_extractor_dispatches_typescript_by_suffix`](../../tests/pkg/test_typescript_extractor.py#L121), [`test_repo_local_target_is_not_invented`](../../tests/pkg/test_typescript_extractor.py#L194)
- **Fields**: `language`, `suffixes`
- **Documented in**: `docs/specs/typescript-codegen.md#slice-1-typescript-comprehension-ships-first-cheap`, `docs/specs/typescript-codegen.md#where-typescript-stands-today`

## Functions

### `_bound_names`

[`src/orchestrator/pkg/typescript_extractor.py:391`](../../src/orchestrator/pkg/typescript_extractor.py#L391)

- **Called by** (1): [`_calls`](../../src/orchestrator/pkg/typescript_extractor.py#L312)
- **Calls** (2): [`_params_of`](../../src/orchestrator/pkg/typescript_extractor.py#L370), [`_pattern_names`](../../src/orchestrator/pkg/typescript_extractor.py#L349)

### `_calls`

[`src/orchestrator/pkg/typescript_extractor.py:312`](../../src/orchestrator/pkg/typescript_extractor.py#L312)

- **Called by** (1): [`extract`](../../src/orchestrator/pkg/typescript_extractor.py#L67)
- **Calls** (6): [`Edge`](../../src/orchestrator/pkg/facts.py#L137), [`Provenance`](../../src/orchestrator/pkg/facts.py#L81), [`_bound_names`](../../src/orchestrator/pkg/typescript_extractor.py#L391), [`_ensure_external`](../../src/orchestrator/pkg/typescript_extractor.py#L243), [`_resolve_callee`](../../src/orchestrator/pkg/typescript_extractor.py#L435), [`_text`](../../src/orchestrator/pkg/typescript_extractor.py#L562)

### `_emit_function`

[`src/orchestrator/pkg/typescript_extractor.py:213`](../../src/orchestrator/pkg/typescript_extractor.py#L213)

- **Called by** (1): [`extract`](../../src/orchestrator/pkg/typescript_extractor.py#L67)
- **Calls** (4): [`Edge`](../../src/orchestrator/pkg/facts.py#L137), [`Node`](../../src/orchestrator/pkg/facts.py#L121), [`Provenance`](../../src/orchestrator/pkg/facts.py#L81), [`_field_text`](../../src/orchestrator/pkg/typescript_extractor.py#L557)

### `_ensure_external`

[`src/orchestrator/pkg/typescript_extractor.py:243`](../../src/orchestrator/pkg/typescript_extractor.py#L243)

- **Called by** (2): [`_calls`](../../src/orchestrator/pkg/typescript_extractor.py#L312), [`_emit_type`](../../src/orchestrator/pkg/typescript_extractor.py#L131)
- **Calls** (1): [`Node`](../../src/orchestrator/pkg/facts.py#L121)

### `_field_text`

[`src/orchestrator/pkg/typescript_extractor.py:557`](../../src/orchestrator/pkg/typescript_extractor.py#L557)

- **Called by** (4): [`_emit_const_functions`](../../src/orchestrator/pkg/typescript_extractor.py#L183), [`_emit_function`](../../src/orchestrator/pkg/typescript_extractor.py#L213), [`_emit_type`](../../src/orchestrator/pkg/typescript_extractor.py#L131), [`extract`](../../src/orchestrator/pkg/typescript_extractor.py#L67)
- **Calls** (1): [`_text`](../../src/orchestrator/pkg/typescript_extractor.py#L562)

### `_import_target`

[`src/orchestrator/pkg/typescript_extractor.py:287`](../../src/orchestrator/pkg/typescript_extractor.py#L287)

- **Called by** (2): [`_resolve_callee`](../../src/orchestrator/pkg/typescript_extractor.py#L435), [`_resolve_type`](../../src/orchestrator/pkg/typescript_extractor.py#L539)
- **Calls** (3): `dirname`, `join`, `normpath`

### `_imported_locals`

[`src/orchestrator/pkg/typescript_extractor.py:490`](../../src/orchestrator/pkg/typescript_extractor.py#L490)

- **Called by** (1): [`_imports`](../../src/orchestrator/pkg/typescript_extractor.py#L100)
- **Calls** (1): [`_text`](../../src/orchestrator/pkg/typescript_extractor.py#L562)

### `_params_of`

[`src/orchestrator/pkg/typescript_extractor.py:370`](../../src/orchestrator/pkg/typescript_extractor.py#L370)

- **Called by** (1): [`_bound_names`](../../src/orchestrator/pkg/typescript_extractor.py#L391)
- **Calls** (1): [`_pattern_names`](../../src/orchestrator/pkg/typescript_extractor.py#L349)

### `_pattern_names`

[`src/orchestrator/pkg/typescript_extractor.py:349`](../../src/orchestrator/pkg/typescript_extractor.py#L349)

- **Called by** (3): [`_bound_names`](../../src/orchestrator/pkg/typescript_extractor.py#L391), [`_params_of`](../../src/orchestrator/pkg/typescript_extractor.py#L370), [`_pattern_names`](../../src/orchestrator/pkg/typescript_extractor.py#L349)
- **Calls** (2): [`_pattern_names`](../../src/orchestrator/pkg/typescript_extractor.py#L349), [`_text`](../../src/orchestrator/pkg/typescript_extractor.py#L562)

### `_relative_module`

[`src/orchestrator/pkg/typescript_extractor.py:267`](../../src/orchestrator/pkg/typescript_extractor.py#L267)

- **Called by** (1): [`_imports`](../../src/orchestrator/pkg/typescript_extractor.py#L100)
- **Calls** (3): `dirname`, `join`, `normpath`

### `_resolve_callee`

[`src/orchestrator/pkg/typescript_extractor.py:435`](../../src/orchestrator/pkg/typescript_extractor.py#L435)

- **Called by** (1): [`_calls`](../../src/orchestrator/pkg/typescript_extractor.py#L312)
- **Calls** (2): [`_import_target`](../../src/orchestrator/pkg/typescript_extractor.py#L287), [`_text`](../../src/orchestrator/pkg/typescript_extractor.py#L562)

### `_resolve_type`

[`src/orchestrator/pkg/typescript_extractor.py:539`](../../src/orchestrator/pkg/typescript_extractor.py#L539)

- **Called by** (1): [`_emit_type`](../../src/orchestrator/pkg/typescript_extractor.py#L131)
- **Calls** (1): [`_import_target`](../../src/orchestrator/pkg/typescript_extractor.py#L287)

### `_supertypes`

[`src/orchestrator/pkg/typescript_extractor.py:523`](../../src/orchestrator/pkg/typescript_extractor.py#L523)

- **Called by** (1): [`_emit_type`](../../src/orchestrator/pkg/typescript_extractor.py#L131)
- **Calls** (1): [`_text`](../../src/orchestrator/pkg/typescript_extractor.py#L562)

### `_text`

[`src/orchestrator/pkg/typescript_extractor.py:562`](../../src/orchestrator/pkg/typescript_extractor.py#L562)

- **Called by** (7): [`_calls`](../../src/orchestrator/pkg/typescript_extractor.py#L312), [`_field_text`](../../src/orchestrator/pkg/typescript_extractor.py#L557), [`_imported_locals`](../../src/orchestrator/pkg/typescript_extractor.py#L490), [`_imports`](../../src/orchestrator/pkg/typescript_extractor.py#L100), [`_pattern_names`](../../src/orchestrator/pkg/typescript_extractor.py#L349), [`_resolve_callee`](../../src/orchestrator/pkg/typescript_extractor.py#L435), [`_supertypes`](../../src/orchestrator/pkg/typescript_extractor.py#L523)

### `_ts_parser`

[`src/orchestrator/pkg/typescript_extractor.py:568`](../../src/orchestrator/pkg/typescript_extractor.py#L568)

- **Called by** (2): [`_parser_for`](../../src/orchestrator/pkg/scope.py#L466), [`extract`](../../src/orchestrator/pkg/typescript_extractor.py#L67)
- **Calls** (4): `language_tsx`, `language_typescript`, `tree_sitter.Language`, `tree_sitter.Parser`
- **Documented in**: `docs/specs/build-documents/PKG-ACC-1-build.md#9-facts-the-generator-needs`

### `_unwrap`

[`src/orchestrator/pkg/typescript_extractor.py:473`](../../src/orchestrator/pkg/typescript_extractor.py#L473)

- **Called by** (1): [`extract`](../../src/orchestrator/pkg/typescript_extractor.py#L67)

## Imports

`__future__.annotations`, [`orchestrator.pkg.extractor`](../../src/orchestrator/pkg/extractor.py#L1), [`orchestrator.pkg.facts`](../../src/orchestrator/pkg/facts.py#L1), `pathlib.Path`, `posixpath`, `tree_sitter.Language`, `tree_sitter.Node`, `tree_sitter.Parser`, `tree_sitter_typescript`, `typing.Any`, `typing.TYPE_CHECKING`

## Imported by

[`orchestrator.pkg.extractor`](../../src/orchestrator/pkg/extractor.py#L1), [`orchestrator.pkg.scope`](orchestrator.pkg.scope.md), [`tests.pkg.test_typescript_extractor`](../../tests/pkg/test_typescript_extractor.py#L1)
