Expand description
Type checker module for TypeScript AST.
This module is organized into several submodules:
context-CheckerContextfor shared stateexpr- Expression type checkingstatements- Statement type checkingdeclarations- Declaration type checkingflow_graph_builder- Control flow graph builderflow_analyzer- Definite assignment analysisreachability_analyzer- Unreachable code detectioncontrol_flow- Flow analyzer for type narrowingerror_reporter- Error reporting utilities
Note: The thin checker is the unified checker pipeline; CheckerState
is an alias to the thin checker.
Re-exports§
pub use context::CheckerContext;pub use context::EnclosingClassInfo;pub use context::TypeCache;pub use dispatch::ExpressionDispatcher;pub use expr::ExpressionChecker;pub use statements::StatementCheckCallbacks;pub use statements::StatementChecker;
Modules§
- accessor_
checker - Accessor declaration validation (abstract consistency, setter parameters).
- assignability_
checker - Type assignability and excess property checking.
- assignment_
checker - Assignment expression checking (simple, compound, logical, readonly).
- call_
checker - Call expression checking (overload resolution, contextual typing, signature instantiation).
- class_
checker - Class/interface declaration checking (inheritance, implements, abstract members).
- class_
inheritance - Class Inheritance Cycle Detection
- class_
type - Class instance type resolution (instance members, inheritance, interface merging).
- constructor_
checker - Constructor type checking (accessibility, signatures, instantiation, mixins).
- context
- Checker Context
- control_
flow - Control Flow Analysis for type narrowing.
- declarations
- Declaration Type Checking
- diagnostics
- dispatch
- Expression type computation dispatcher.
- enum_
checker - Enum type checking (detection, member types, assignability, const enums).
- error_
reporter - Error reporting (
error_*for emission,report_*for higher-level wrappers). This module is split into focused submodules for maintainability. - expr
- Expression Type Checking
- flow_
analysis - Flow Analysis Module
- flow_
analyzer - Definite Assignment Analysis for control flow analysis.
- flow_
graph_ builder - Flow Graph Builder for Control Flow Analysis.
- function_
type - Function, method, and arrow function type resolution.
- generic_
checker - Generic type argument validation (TS2344 constraint checking).
- import_
checker - Import/export declaration validation (TS2307, TS2305, TS2309, TS1202).
- interface_
type - Interface type resolution (heritage merging, structural merge).
- iterable_
checker - Iterable/iterator protocol checking and for-of element type computation.
- jsx_
checker - JSX type checking (element types, intrinsic elements, namespace types).
- judge_
integration - Judge Integration for the Checker
- literal_
type - Literal Type Utilities Module
- module_
checker - Module import/export validation and circular re-export detection.
- module_
resolution - Module resolution utilities for multi-file type checking.
- namespace_
checker - Namespace type merging and re-export resolution for declaration merging.
- object_
type - Object Type Utilities Module
- optional_
chain - Optional Chaining Type Checking
- parameter_
checker - Function parameter validation (duplicates, ordering, initializers).
- private_
checker - Private field access and brand checking for nominal class typing.
- promise_
checker - Promise/async type checking (detection, type argument extraction, return types).
- property_
checker - Property access checking (accessibility, computed names, const modifiers).
- reachability_
analyzer - Reachability Analysis for detecting unreachable code.
- reachability_
checker - Code reachability and fall-through analysis.
- scope_
finder - Enclosing scope and context traversal (functions, classes, static blocks).
- signature_
builder - Call/construct signature building (parameter extraction, instantiation, return types).
- state
CheckerState- Type Checker Orchestration Layer- state_
checking - Declaration and statement checking, including
StatementCheckCallbacks. - state_
type_ analysis - Type analysis: qualified name resolution, symbol type computation, type queries, and contextual literal type analysis.
- state_
type_ environment - Type environment building, application type evaluation, property access type resolution, and type node resolution.
- state_
type_ resolution - Type reference resolution: interfaces, type aliases, and type references
on
CheckerState. - statements
- Statement Type Checking
- subtype_
identity_ checker - Subtype checking, type identity, and redeclaration compatibility.
- super_
checker - Super expression validation (calls, property access, derived class requirements).
- symbol_
resolver - Symbol resolution helpers (type resolution, intrinsic detection, identifier lookup).
- triple_
slash_ validator - Triple-slash reference directive validation
- type_
checking - Type checking validation: utility methods, AST traversal helpers, member/declaration/private identifier/parameter property validation, destructuring, import/return/await/variable/using declaration validation.
- type_
computation - Type computation helpers, relationship queries, and format utilities.
This module extends
CheckerStatewith additional methods for type-related operations, providing cleaner APIs for common patterns. - type_
literal_ checker - Type literal checking (type resolution, references, and signatures within type literals).
- type_
node - Type Node Checking
Structs§
- Assignment
State Map - A mapping of variables to their assignment states at a point in the program.
- Checker
Options - Compiler options for type checking.
- Checker
State - Type checker state using
NodeArenaand Solver type system. - Control
Flow Graph - A control flow graph that provides query methods for flow analysis.
- Declaration
Checker - Declaration type checker that operates on the shared context.
- Definite
Assignment Analyzer - Analyzer that performs definite assignment analysis.
- Definite
Assignment Result - Definite assignment analysis result for a specific program point.
- Flow
Analyzer - Flow analyzer for control flow-based type narrowing.
- Flow
Graph - A control flow graph side-table.
- Flow
Graph Builder - Builder for constructing a
FlowGraphfrom Node AST. - Reachability
Analyzer - Analyzer for detecting unreachable code.
- Type
Node Checker - Type node checker that operates on the shared context.
Enums§
- Assignment
State - Assignment state for a single variable at a point in the control flow.
- Visibility
- Visibility modifier for class properties
Constants§
- MAX_
CALL_ DEPTH - Maximum depth for function call resolution.
- MAX_
INSTANTIATION_ DEPTH - Maximum depth for generic type instantiation.
Functions§
- merge_
assignment_ states - Merges multiple assignment state maps at a control flow join point.