/** * TypeScript Integration * * Wraps TypeScript's Language Service for diagnostic collection and code fix retrieval. */ import ts from "typescript"; import { VirtualFS } from "./vfs.js"; import type { DiagnosticRef, FileChange } from "../output/types.js"; export interface TypeScriptHost { /** Get all diagnostics from the project */ getDiagnostics(): ts.Diagnostic[]; /** Get code fixes for a specific diagnostic */ getCodeFixes(diagnostic: ts.Diagnostic): readonly ts.CodeFixAction[]; /** Apply a code fix to the VFS */ applyFix(fix: ts.CodeFixAction): void; /** Get the VFS for snapshot/restore */ getVFS(): VirtualFS; /** Get compiler options */ getOptions(): ts.CompilerOptions; /** Get file names */ getFileNames(): string[]; /** * Notify the host that files have changed externally (e.g., after VFS restore). * This bumps all file versions so the LanguageService re-checks everything. */ notifyFilesChanged(): void; /** * Reset the host to its initial state (VFS reset + version bump). * Useful for test isolation when reusing hosts. */ reset(): void; } /** * Create a TypeScript host from a project config. * * Performance optimization: The language service is created once and reused. * File versions are tracked per-file and incremented when the VFS changes, * allowing TypeScript's incremental checker to recompute only what's needed. */ export declare function createTypeScriptHost(configPath: string): TypeScriptHost; /** * Convert a TypeScript diagnostic to our DiagnosticRef format */ export declare function toDiagnosticRef(diagnostic: ts.Diagnostic): DiagnosticRef; /** * Convert a CodeFixAction's changes to our FileChange format */ export declare function toFileChanges(fix: ts.CodeFixAction): FileChange[]; //# sourceMappingURL=typescript.d.ts.map