Skip to content

tsox Documentation ​

This directory is the maintained technical guide for tsox, and the source of the documentation site (https://tsoxide.github.io/tsox/).

The repository uses semantic milestone names instead of opaque numeric development labels. A contributor should be able to understand what a test suite or document covers from its name alone.

Current semantic baseline ​

text
Foundation
    ↓
Structural Types
    ↓
Literal Widening
    ↓
Control-Flow Narrowing
    ↓
Classes and Inheritance
    ↓
Expression and Program Checking
    ↓
Parameters and Destructuring
    ↓
Generics (functions, interfaces, aliases, classes, recursion, builtins)
    ↓
Narrowing completion, sessions and file identity (joins, discriminated unions, `in`/`instanceof`, `CheckSession`)
    ↓
Module Resolution (opt-in `module-resolution` feature: resolver, module graph, cycles, layers, project check)
    ↓
Architecture Foundation (opt-in `incremental`, `scratchpad` and `mimalloc` features)
    ↓
Declaration Slots and Named Nodes (`Ref` slots, `Named` and `App` nodes)
    ↓
Intersection Types
    ↓
Cross-File Types (stable keys, portable declarations, units, imports and exports)
    ↓
Project Engine (scheduler, partial results, cycles, configuration, library and ambient declarations, query layer) ← current baseline

These names describe capabilities. They are not release versions and should not be interpreted as a versioning scheme.

For what the checker catches today across the whole type system, measured against tsc and not only along this milestone list, see language-coverage. For how it does on the compiler's own tests, see the conformance baseline.

Milestones ​

MilestonePurposeTestsDocumentation
FoundationEstablish the end-to-end checker, primitive types, basic functions, diagnostics, and honest unsupported-feature handling.tests/foundation.rsfoundation
Structural TypesAdd objects, arrays, unions, aliases, interfaces, declaration resolution, structural subtyping, and function arity.tests/structural_types.rsstructural-types
Literal WideningPreserve literal information while modeling widening behavior.tests/literal_widening.rsliteral-widening
Control-Flow NarrowingRefine types across branches and flow paths.tests/control_flow_narrowing.rsnarrowing
Classes and InheritanceModel class members, constructors, inheritance, static state, and this.tests/classes_inheritance.rsclasses-inheritance
Expression and Program CheckingExpand expression inference, calls, members, logical operations, loops, switches, assertions, and program-level checking.tests/expression_program_checking.rsexpression-program-checking
Parameters and DestructuringModel parameter metadata and binding/destructuring semantics.tests/parameters_destructuring.rsparameters-destructuring
GenericsType parameters on functions, interfaces, aliases, and classes: inference, substitution, constraints, defaults, explicit type arguments, recursive generic shapes, and builtin generics (Array<T>, opaque Promise<T>). One consolidated document, not split by tier — see it for why.tests/generics_tier1.rs, tests/generics_tier2.rs, tests/generic_classes.rs, tests/recursive_types.rs, tests/builtin_generics.rs, tests/interface_methods.rsgenerics
Intersection TypesA & B: ordered identity, construction rules checked against tsc, lazy reduction of discriminant conflicts, relations, member access, calls and generics. 25 + 10 unit tests, 17 fixtures. Calls through an intersection of functions and TS2590 follow tsc; narrowing does not see intersections.tests/intersection_types.rs, tests/intersection_overloads.rs, unit tests in crates/tsox-types/src/arena.rs and crates/tsox-types/src/subtyping.rsintersections
Declaration slots and named nodes (stage 1, steps 1 and 2)Interfaces, classes and object-literal aliases are Ref slots that are never rewritten, and a name lives on a Named or App node instead of on an id. set, placeholders, display_names, make_unique, duplicate_named and the settled-display check are gone. Object properties are not yet bump slices (step 3).unit tests in crates/tsox-types/src/arena.rs and crates/tsox-types/src/type_display.rs; the existing fixtures unchangedarena
Module ResolutionResolve imports with oxc_resolver, build a graph indexed by FileId, detect cycles, order files into dependency layers, check a project in parallel, and detect changed files. Behind the module-resolution feature. What the checker does with the files it is handed is the next row.tests/module_resolution.rs (run with --features module-resolution)module-resolution
Architecture FoundationSalsa, a bump scratchpad that takes only Copy values, and mimalloc, each behind its own feature. The Salsa input grew into the query layer; petgraph was tried and removed.unit tests in crates/tsox-db/src/incremental.rs, crates/tsox-base/src/scratchpad.rsfoundation-dependencies
Cross-File TypesA declaration gets an identity that survives a run and moves between arenas as data. A file is a unit with an owned output, a layer's exports reach the files that import it, imports are diagnosed (TS2307, TS2305, TS1192) against complete export lists, and cycles are checked again until their exports settle. Classes, enums, overloads, default exports and installed packages cross files.tests/unit_exports.rs, tests/unit_imports.rs, tests/project_imports.rs, tests/import_diagnostics.rs; golden hashes in crates/tsox-base/src/stable_hash.rs and crates/tsox-types/src/portable.rscross-file-types
Project EngineA project is checked as a set of files: a ready-queue scheduler, partial export lists with named reasons, import cycles settled as one unit, tsconfig.json as a graph input, globals, augmentations and library members, resource limits that report instead of guessing, and a query layer for incremental and watch mode.tests/scheduler.rs, tests/scc_contract.rs, tests/project_config.rs, tests/incremental_project.rs, crates/tsox-cli/tests/project-engine

Later work extends these milestones rather than adding a tier: tests/narrowing_advanced.rs and tests/narrowing_complete.rs (switch, &&/||, loops, joins, in, instanceof), tests/generics_bounds.rs (literal-preserving inference, explicit type arguments), tests/declaration_collisions.rs, tests/union_member_access.rs and tests/check_session.rs (sessions, metrics, file identity), tests/unreachable_scopes.rs (dead code in every construct, checked against tsc line for line) and tests/everyday_patterns.rs (empty arrays, parameter properties, boolean discriminants, generic callbacks).

A handful of smaller, cross-cutting suites support these milestones rather than being their own tier: tests/call_arity.rs, tests/void_and_never.rs, tests/unreachable_code.rs, tests/named_types_in_messages.rs, tests/diagnostic_codes.rs, tests/misc_fixes.rs, and tests/subtype_cache_stress.rs (a performance/correctness regression suite, not a feature milestone).

Architecture case studies ​

docs/architecture/ holds one document per subsystem, each written as what was planned, the issue that was found, what was changed and what it gained:

  • arena: ids, interning, Ref slots, named nodes, digest collisions, the performance phases.
  • narrowing: the overlay, joins, discriminants, loops and unreachable code.
  • generics: type parameter identity, inference, substitution, bounds.
  • intersections: ordered identity and lazy reduction.
  • module-resolution: the resolver, the graph, layers and the project check.
  • cross-file-types: keys, portable declarations, units, imports and exports.
  • foundation-dependencies: Salsa, bump allocation, mimalloc.
  • flow: the flow graph built for every function body.
  • workspace: the twelve crates, the one-way dependency rule and how it is checked, features, and the front-end crates.

The project engine has its own overview and one case study for each part:

  • project-engine: what the engine is for, the order it was built in, the exit gate and what it taught.
  • diagnostic-owners: generated map of every diagnostic code to its message function and the code that raises it, with the unchecked (9000s) backlog.
  • registries: the rule tables (PASSES, NARROWERS, EQUALITY_RULES, CALL_FORMS) and how to add a rule.
  • remaining-work-gap-register: generics solver, options, language areas, build mode, declaration emit, robustness, open-source readiness, with a master checklist.
  • new-architecture-progress: what has moved to the modular layout and what is next.
  • safety-net-and-limits: no abort on hostile input, deterministic output, and limits that report instead of guessing.
  • partial-results: what a checker does when a file's exports are known only in part.
  • cycles-and-settlement: which edges order the work, and a cycle as one unit.
  • scheduler: dependency counts, one read per file, and a parse that is not shared.
  • project-configuration: tsconfig.json as a graph input, and when a package may be called missing.
  • library-and-ambient-declarations: globals, library members, augmentation, import types, type roots.
  • query-layer: re-checking only what a change reaches.

Where the checker stands is in language-coverage.

Why it is built this way ​

case-study.md collects the design decisions in one place: the problem each solves, what was rejected, and how it was checked. Start there when a choice looks odd. decisions.md is the shorter list of design decisions and what would reopen each.

Architecture ​

Read architecture.md for the current ownership model.

The short version is:

text
Oxc
  ↓
bridge
  ↓
semantic layer
  ↓
TypeArena / TypeNamespace / Subtyping / Generics / Narrowing
  ↓
diagnostics + future semantic facts
  ↓
tooling / typed IR

Oxc remains the front-end foundation. tsox implements the semantic behavior that sits on top of it.

Roadmap ​

roadmap.md covers the project's longer-term direction (semantic facts, typed IR, project-scale checking, performance philosophy) that doesn't change week to week.

What is open now is the Next list in the roadmap, the open items at the end of each case study, and the gaps in language-coverage and the conformance baseline.

Testing and performance ​

Read testing.md for:

  • semantic fixture conventions;
  • regression policy;
  • formatting/check/lint/test commands;
  • Criterion and IAI benchmarks;
  • heap profiling;
  • compatibility harness expectations.

Design boundaries ​

Read purpose-and-overdesign.md for:

  • why tsox builds on Oxc;
  • what tsox owns;
  • what it deliberately does not rebuild;
  • how larger projects such as tsz are used as references;
  • why premature abstraction and premature multithreading are avoided.

MIT OR Apache-2.0