tsz-checker 0.1.2

TypeScript type checker for the tsz compiler
Documentation
//! # CheckerState - Type Checker Orchestration Layer Documentation
//!
//! This module serves as the orchestration layer for the TypeScript type checker.
//! It coordinates between various specialized checking modules while maintaining
//! shared state and caching for performance.
//!
//! ## Architecture - Modular Design
//!
//! The checker has been decomposed into focused modules, each responsible for
//! a specific aspect of type checking:
//!
//! ### Core Orchestration (This Module - state.rs)
//! - **Entry Points**: `check_source_file`, `check_statement`
//! - **Type Resolution**: `get_type_of_node`, `get_type_of_symbol`
//! - **Caching & Lifecycle**: `cache_symbol_type`, node type cache management
//! - **Delegation**: Coordinates calls to specialized modules
//!
//! ## Extracted Modules
//!
//! ### Type Computation (type_computation.rs - 3,189 lines)
//! - `get_type_of_binary_expression`
//! - `get_type_of_call_expression`
//! - `get_type_of_property_access`
//! - `get_type_of_element_access`
//! - `get_type_of_object_literal`
//! - `get_type_of_array_literal`
//! - And 30+ other type computation functions
//!
//! ### Type Checking (type_checking.rs - 9,556 lines)
//! - **Section 1-54**: Organized by functionality
//! - Declaration checking (classes, interfaces, enums)
//! - Statement checking (if, while, for, return)
//! - Property access validation
//! - Constructor checking
//! - Function signature validation
//!
//! ### Symbol Resolution (symbol_resolver.rs - 1,380 lines)
//! - `resolve_type_to_symbol`
//! - `resolve_value_symbol`
//! - `resolve_heritage_symbol`
//! - Private brand checking
//! - Import/Export resolution
//!
//! ### Flow Analysis (flow_analysis.rs - 1,511 lines)
//! - Definite assignment checking
//! - Type narrowing (typeof, discriminant)
//! - Control flow analysis
//! - TDZ (temporal dead zone) detection
//!
//! ### Error Reporting (error_reporter.rs - 1,923 lines)
//! - All `error_*` methods
//! - Diagnostic formatting
//! - Error reporting with detailed reasons
//!
//! ## Remaining in state.rs (~12,974 lines)
//!
//! The code remaining in this file is primarily:
//! 1. **Orchestration** (~4,000 lines): Entry points that coordinate between modules
//! 2. **Caching** (~2,000 lines): Node type cache, symbol type cache management
//! 3. **Dispatchers** (~3,000 lines): `compute_type_of_node` delegates to type_computation functions
//! 4. **Type Relations** (~2,000 lines): `is_assignable_to`, `is_subtype_of` (wrapper around solver)
//! 5. **Constructor/Class Helpers** (~2,000 lines): Complex type resolution for classes and inheritance
//!
//! ## Performance Optimizations
//!
//! - **Node Type Cache**: Avoids recomputing types for the same node
//! - **Symbol Type Cache**: Caches computed types for symbols
//! - **Fuel Management**: Prevents infinite loops and timeouts
//! - **Cycle Detection**: Detects circular type references
//!
//! ## Usage
//!
//! ```rust
//! use crate::checker::state::CheckerState;
//!
//! let mut checker = CheckerState::new(&arena, &binder, &types, file_name, options);
//! checker.check_source_file(root_idx);
//! ```
//!
//! ## Step 12: Orchestration Layer Documentation ✅ COMPLETE
//!
//! **Date**: 2026-01-24
//! **Status**: Documentation complete
//! **Lines**: 12,974 (50.5% reduction from 26,217 original)
//! **Extracted**: 17,559 lines across 5 specialized modules
//!
//! The 2,000 line target was deemed unrealistic as the remaining code is
//! necessary orchestration that cannot be extracted without:
//! - Breaking the clean delegation pattern to specialized modules
//! - Creating circular dependencies between modules
//! - Duplicating shared state management code