Skip to content

Commit b4b9732

Browse files
committed
fix(examples): type the multi-package fixture against spec SOURCE
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHvF5hyiZjnCyExFnfQB8m
1 parent 0604141 commit b4b9732

1 file changed

Lines changed: 38 additions & 6 deletions

File tree

‎examples/app-multi-package/tsconfig.json‎

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,45 @@
66
"strict": true,
77
"esModuleInterop": true,
88
"forceConsistentCasingInFileNames": true,
9+
// `lib` and `types` are here as a CONSEQUENCE of the `paths` block below,
10+
// not as a preference — the same correction `packages/qa/downstream-contract`
11+
// made for the same reason. Putting `packages/spec/src` into this program
12+
// means tsc now checks spec's own source files, which are written against
13+
// spec's own environment (`packages/spec/tsconfig.json`: `lib` ES + DOM +
14+
// DOM.Iterable, `types` node). Without them the first run reported two
15+
// `TS2591: Cannot find name 'process'` in `spec/src/shared/lazy-schema.ts`
16+
// — a verdict about THIS package's compiler environment, not about the
17+
// fixture. Mirroring spec's own environment keeps every red here
18+
// attributable to this app's own metadata.
19+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
20+
"types": ["node"],
921
"skipLibCheck": true,
10-
"outDir": "./dist",
11-
"rootDir": ".",
12-
// `check:type-source-resolution` — without these, this package's type
13-
// verdicts would be a function of `packages/spec/dist` rather than of the
14-
// source in this checkout, and the dangerous direction is SILENT: a `dist`
15-
// merely BEHIND the source type-checks GREEN against old declarations.
22+
// `outDir` / `rootDir` are absent and `noEmit` is set as a CONSEQUENCE of
23+
// the `paths` block below — the same correction examples/app-crm and
24+
// examples/app-showcase made for the same reason. tsc emits nothing for
25+
// this app either way (`typecheck` is `tsc --noEmit`; the app is BUILT by
26+
// the ObjectStack CLI, not by tsc), but an emit-shaped config still
27+
// enforces the output-tree rules: `rootDir` is inferred from the `include`
28+
// roots, so spec's source — pulled in by an import, never a root —
29+
// produced a wall of `TS6059: File '.../packages/spec/src/...' is not
30+
// under 'rootDir'` that would drown any real error this typecheck exists
31+
// to print.
32+
"noEmit": true,
33+
//
34+
// Without this rule `@objectstack/spec` resolves through the workspace
35+
// link to `packages/spec/dist/*.d.ts` — a BUILD ARTIFACT — so
36+
// `tsc --noEmit` would grade this project against whatever was last built
37+
// rather than against the source in this checkout, and the dangerous
38+
// direction is SILENT: a `dist` merely BEHIND the source type-checks GREEN
39+
// against old declarations. This app is the fixture for a brand-new spec
40+
// surface (ADR-0130 D4's `packages[]`), which makes that exactly the
41+
// reading it must not be able to give. `pnpm check:type-source-resolution`
42+
// is the gate; it wants the `paths` rule, not a registry entry.
43+
//
44+
// Two keys, and the star follows a separator: a tsconfig `paths` key
45+
// without a star is an EXACT match, and the `@objectstack/spec*` spelling
46+
// would fold every subpath onto the root target and type-check green
47+
// against the wrong module.
1648
"paths": {
1749
"@objectstack/spec": ["../../packages/spec/src/index.ts"],
1850
"@objectstack/spec/*": ["../../packages/spec/src/*/index.ts"]

0 commit comments

Comments
 (0)