TypeScript Code Analysis

Deep analysis of TypeScript applications, React/Angular/Vue frontends, Node.js backends, and monorepo structures

What Axiom Refract Analyzes in TypeScript

Module Resolution

Resolves TypeScript module imports following the Node.js, Node16, Bundler, and classic resolution algorithms. Handles path aliases from tsconfig.json, barrel exports, and re-export chains across package boundaries.

Type System Dependency Extraction

Extracts dependencies created through type imports, interface extensions, type aliases, generic constraints, conditional types, and mapped types. Distinguishes between runtime and type-only dependencies.

React Component Graph

Maps React component hierarchies including JSX element usage, prop drilling chains, context provider/consumer relationships, and hook dependency patterns across component trees.

Decorator and Metadata Analysis

Parses TypeScript decorators used in Angular, NestJS, TypeORM, and other frameworks. Extracts metadata-driven dependency relationships that are invisible to standard import analysis.

Monorepo Workspace Resolution

Resolves cross-package dependencies in Nx, Turborepo, Lerna, and pnpm workspace monorepos. Maps the inter-package dependency graph alongside intra-package file dependencies.

How It Works

TypeScript is parsed using a hand-hardened Tree-sitter grammar that covers TypeScript 4.x through 5.x syntax, including satisfies operator, const type parameters, decorators (stage 3), and using/await using declarations. The parser resolves tsconfig.json path mappings and project references to accurately map cross-project dependencies in composite builds. JSX and TSX are parsed with full support for generic components and conditional rendering patterns.

Common Findings in TypeScript Codebases

Barrel Export Bottlenecks

TypeScript projects frequently use index.ts barrel files that re-export everything from a directory. These barrels become high-centrality SPOFs where a single file change triggers rebuilds across all consumers.

Type-Only Coupling

TypeScript's type system can create coupling between modules that share no runtime dependency. Axiom identifies type-only import relationships and distinguishes them from runtime dependencies in the architectural graph.

Circular Dependencies via Re-exports

Barrel exports and re-export chains in TypeScript create circular dependency cycles that are difficult to detect manually. Axiom identifies these cycles and traces the chain.

Framework Integration Coupling

Angular modules, NestJS providers, and Next.js page/layout hierarchies create framework-specific dependency patterns that standard import analysis misses. Axiom detects these framework-driven architectural relationships.

Polyglot Support

TypeScript is one of 145+ languages Axiom Refract supports through Tree-sitter AST parsing. TypeScript analysis covers package.json, pnpm-workspace.yaml, nx.json, turbo.json, tsconfig.json project references, and yarn/pnpm/npm lockfiles. Build tool configurations for Webpack, Vite, esbuild, SWC, and tsc are parsed for additional dependency resolution context. Your entire codebase is analyzed in a single scan — regardless of how many languages it contains.

Analyze your TypeScript codebase.