Repository navigation
Description
What's wrong
Three comments in pnpm-workspace.yaml say @effect/docgen drives TypeScript through the JS API and so "sees the TS6 side of the split". For the pinned docgen (^0.5.2, locked at 0.5.2) that is not true. docgen never loads the typescript package at all.
- The catalog entry (lines 35–37): "Drives TypeScript through the JS API, so it sees the TS6 side of the split."
- The
typescriptcatalog entry (line 70) lists@effect/docgenamong the JS-API consumers that "stay on TS6". - The
"@effect/docgen>typescript": "6"peer rule (lines 151–153): "drives it through the JS API, which the TS6 alias above still provides".
Evidence
I checked npm pack @effect/docgen@0.5.2 in a fresh empty directory.
- The package ships only
bin.cjs(13.8 MB),package.jsonandschema.json.bin.cjsis an esbuild bundle that inlinests-morph@23.0.0together with@ts-morph/common@0.24.0/dist/typescript.js, which is TypeScriptversion = "5.5.2". It contains norequire("typescript"). Its externalrequires are Node built-ins plusdoctrine,glob,prettierandsource-map-support. So docgen parsessrc/with its own bundled TypeScript 5.5.2, underparseCompilerOptions. runTscOnExamplesspawnsmake("tsc", "--noEmit", "--project", <outDir>/examples/tsconfig.json). That is thetsconPATH, which undervp runis the native TS7tsc, as docs(AGENTS): say whatvp run docgenruns and with which tsc #298 recorded.runTsxOnExamplesspawnstsx --tsconfig … <outDir>/examples/index.ts. That matches what thetsxcatalog comment says.handleImports→addAssertImportprependsimport * as assert from 'assert'to any example containingassert..scripts/docgen-class-examples.tsmirrors this. Nosrc/example usesassert.today.- To confirm at runtime, I ran
node --require <hook> node_modules/@effect/docgen/bin.cjson trunk, with a hook that logs everyModule._loadrequest matchingtypescript. Across a full successful run (24 modules, 226 examples), the only request was./node_modules/@microsoft/typescript-etw, the bundled compiler's optional ETW probe. Nothing in the run resolved thetypescriptpackage.
So the typescript peer declared by docgen 0.5.2 (^5.2.2) is never used. The "@effect/docgen>typescript": "6" rule only quiets pnpm's peer-range check. It does not prove that TS6 works for docgen. In this repo the TS6 alias is loaded by scripts/docgen-class-examples.ts (import ts from "typescript"), the tsdown bundler and the language service, but not by docgen.
Proposed fix (this issue's PR)
This is a comment-only change to pnpm-workspace.yaml. The docgen version and the peer rule stay as they are. The rule is still needed while 0.5.x declares typescript ^5.2.2.
For the owner to decide: the docgen 4.x move pulpit made
pulpit moved to docgen 4.x in thomasfosterau/pulpit#97 (with #88/#96). The findings behind that move are in pulpit#62 and pulpit#8/#64. Checked against npm pack @effect/docgen@4.0.4:
- It peers
typescript >=5.8.2 <7.0.0andtsx >=4.19.3 <5.0.0. The TS6 alias satisfies that range, so the"@effect/docgen>typescript"peer rule could be deleted. - It depends on
ts-morph ^28andtsconfckrather than bundling a compiler. It also adds atscExecutableoption. - It does not inject
import * as assert. pulpit made its examples importassertexplicitly by name. runExamplesdefaults tofalse(type-check only). pulpit set"runExamples": trueindocgen.jsonso its examples kept executing. Without that setting this repo'svp run docgenwould silently stop running examples, and AGENTS.md's "executes your examples" section depends on them running.
scripts/docgen-class-examples.ts re-implements 0.5.2's pipeline (including the assert injection). It would need to be re-checked against 4.x, which may also collect class examples itself (#276, #288).
Also for the owner: AGENTS.md repeats the claim
AGENTS.md is the owner's file, so the PR leaves it untouched. The wording approved in #290 / #298 has the same inaccuracy:
- Line 9: "TS6 … is only what the JS-API consumers —
@effect/docgen's parse, …— load". docgen's parse uses its bundled TS 5.5.2. - Line 34: "Docgen parses
src/through the TypeScript JS API, so its parse sees the TS6 side of the split". The parse is through the bundled TS 5.5.2. Thetypes: ["node"]rationale ("TypeScript 6 no longer auto-includes@types") still holds forexamplesCompilerOptions(TS7). It does not hold forparseCompilerOptions(TS 5.5.2 still auto-includes), where the setting is harmless.
A possible line-34 wording: "Docgen 0.5.x parses src/ with its own bundled TypeScript 5.5.2 (via ts-morph), under parseCompilerOptions; it never loads the TS6 alias."
Done when
- The
pnpm-workspace.yamlcomments describe what docgen 0.5.2 actually loads and spawns. - The owner decides on the 4.x move and on the AGENTS.md wording. Either can be split out.
Generated by Claude Code
Activity
thomasfosterau commentedon Oct 21, 2026
Owner decision (2026-10-21): docgen is now on 4.0.5 (#222 merged). Bring the
pnpm-workspace.yamlcomments and AGENTS.md up to date for 4.x (AGENTS.md edits approved for this), and drop the@effect/docgen>typescriptpeer rule if 4.x's declared range admits the TS6 alias. #288 is folded in: check whether 4.x collects class/property examples itself, and either simplifyscripts/docgen-class-examples.tsor extend it to property examples.Generated by Claude Code