import { type AcquisitionStats, type MissingTypes, type TypecheckSources } from "./acquireTypes.js"; import { type PnpmLayout } from "./pnpmLayout.js"; import { type PnpmLockfile } from "./pnpmLockfile.js"; import { type CompilerChoice } from "./typescriptCompiler.js"; /** * The type errors a project would have after `pnpm install`, computed in * memory: the layout from the lockfile, the types its imports reach from * adept, and the project's own TypeScript over both. See `docs` in * valbuild/home's `adept.md`, step 4. */ export type TypecheckInput = { /** The project's files, by `/`-separated path relative to its root. */ files: Record; lockfile: string; /** `pnpm-workspace.yaml`, when the project has one: it can change the layout. */ workspace?: string | null; sources: TypecheckSources; onProgress?: (progress: TypecheckProgress) => void; /** Also return every file in each program, as `tsc --listFiles` prints them. */ listFiles?: boolean; }; export type TypecheckProgress = { step: "layout"; } | { step: "compiler"; version: string; } | { step: "types"; fetched: number; } | { step: "check"; tsconfig: string; }; export type TypeErrorEntry = { /** Relative to the project's root; `null` for an error of no file (an option, a missing lib). */ file: string | null; /** 1-based. */ line: number | null; column: number | null; code: number; message: string; /** The tsconfig whose program reported it. */ tsconfig: string; }; export type ProgramSummary = { tsconfig: string; /** Files in the program, the project's and the declarations it reached. */ files: number; errors: number; /** With `listFiles`: each file's path, relative to the project's root when it is under it. */ fileNames?: string[]; }; export type TypecheckResult = { errors: TypeErrorEntry[]; programs: ProgramSummary[]; typescript: CompilerChoice; bundles: AcquisitionStats & { count: number; rounds: number; }; /** Packages whose types could not be fetched: errors about them may be wrong. */ missing: MissingTypes[]; timings: { layoutMs: number; compilerMs: number; typesMs: number; checkMs: number; totalMs: number; }; }; /** The project's root in the file system the checker builds. */ export declare const PROJECT_ROOT = "/project"; export declare function layoutOf(input: { lockfile: string; workspace?: string | null; files: Record; }): { lockfile: PnpmLockfile; layout: PnpmLayout; }; /** Typechecks a project as it would be after `pnpm install`. */ export declare function typecheckProject(input: TypecheckInput): Promise; /** * The errors of `next` that `base` does not have (decision 20): an upgrade * is judged only by the errors it adds. Errors are matched by file, code and * message, not by position, so that an error which only moved is not new; * and counted, so that a second copy of an error the base has once is. */ export declare function newErrors(base: TypeErrorEntry[], next: TypeErrorEntry[]): TypeErrorEntry[];