UNPKG

vite-plugin-checker

Version:

Vite plugin that runs TypeScript type checker on a separate process.

25 lines (22 loc) 1.24 kB
import * as ts from 'typescript'; import ts__default from 'typescript'; /** * 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__default.SolutionBuilderHostBase<ts__default.BuilderProgram>['getParsedCommandLine']; }>(ts: typeof ts, host: H): H; export { forceNoEmitOnSolutionBuilderHost };