Skip to content

Commit 75ac3f6

Browse files
authored
fix(orval): pass skipErrorChecking to TypeDoc to scope it to generated entry points (orval-labs#3338) (orval-labs#3345)
When `output.docs` is enabled, orval boots TypeDoc with the generated `.ts` files as entry points. TypeDoc, however, still auto-discovers the consumer's tsconfig and builds a single `ts.Program` from it — which means it runs full TypeScript diagnostics over the whole consumer project, not just the files orval emitted. The two observable consequences on master: 1. Diagnostics from files orval has nothing to do with (e.g. an unused `React` default import in a demo `App.tsx` under the React 17+ JSX transform) leak into orval's stdout — the symptom originally reported in orval-labs#3338. 2. Because `app.convert()` returns `undefined` whenever those diagnostics exist, the catch path logs "TypeDoc not initialized" and the docs are silently dropped. The `docs` option has effectively been broken for any project with a single unrelated TS error. Type-checking the consumer's project is not orval's responsibility — that lives in the consumer's own build. Pass `skipErrorChecking: true` to the TypeDoc bootstrap so docs generation only depends on the entry points orval actually produced. The option is placed before `...config`, so users who explicitly want strict checking can re-enable it via `docs: { skipErrorChecking: false }`. After the fix, `samples/react-app` generates the previously-silently-dropped docs and emits no unrelated diagnostics.
1 parent aca8a07 commit 75ac3f6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/orval/src/write-specs.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,12 @@ export async function writeSpecs(
463463
const app = await Application.bootstrapWithPlugins({
464464
entryPoints: paths.map((x) => upath.toUnix(x)),
465465
theme: 'markdown',
466+
// Skip TypeScript diagnostics on the consuming project: TypeDoc would
467+
// otherwise pick up the user's tsconfig and surface errors from files
468+
// unrelated to the generated entry points (e.g. a demo `App.tsx`
469+
// with an unused `React` default import under the new JSX transform —
470+
// see #3338). User-overridable via the `docs` option below.
471+
skipErrorChecking: true,
466472
// Set the custom config location if it has been provided.
467473
...config,
468474
plugin: ['typedoc-plugin-markdown', ...(config.plugin ?? [])],

0 commit comments

Comments
 (0)