site-panzai/node_modules/vite-plugin-checker/dist/checkers/tscUtils.d.ts

25 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2026-11-13 13:57:04 +01:00
import ts from "typescript";
//#region src/checkers/tscUtils.d.ts
/**
* Wrap a `SolutionBuilderWithWatchHost` so that when a referenced project's
* tsconfig fails to parse, we force `compilerOptions.noEmit` to `true` instead
* of letting TS fall back to defaults (which include `noEmit: false`).
*
* `createSolutionBuilderWithWatch` takes its emit decisions from each referenced
* project's own `compilerOptions`. If a referenced tsconfig is truncated or
* mid-write at the moment TS reads it (which can happen e.g. when a dev tool
* rewrites tsconfigs at runtime), TS falls back to default options — and the
* default is `noEmit: false`, so the build host writes `.js` files next to
* sources. See https://github.com/nuxt/nuxt/issues/32872.
*
* We deliberately only override when parsing produced errors: forcing
* `noEmit: true` on every parsed project would break valid `tsc --build`
* graphs, since composite referenced projects must emit declarations.
*/
declare function forceNoEmitOnSolutionBuilderHost<H extends {
getParsedCommandLine?: ts.SolutionBuilderHostBase<ts.BuilderProgram>['getParsedCommandLine'];
}>(ts: typeof import('typescript'), host: H): H;
//#endregion
export { forceNoEmitOnSolutionBuilderHost };
//# sourceMappingURL=tscUtils.d.ts.map