|
| 1 | +// The TEST-layer type-check program (#14181 — the `packages/services/**` |
| 2 | +// instance of the class #14062 settled for `packages/plugins/**`, itself |
| 3 | +// adopting the mechanism #5286 set for `packages/spec`, #5449 generalised, |
| 4 | +// #12542 carried to `packages/rest` and #13176 to `packages/plugins/ |
| 5 | +// plugin-security`). `tsconfig.json` beside this one stays exactly as it is: it |
| 6 | +// is the BUILD config. This sibling puts the test layer in front of tsc under |
| 7 | +// the module semantics vitest really executes it with, and `package.json`'s |
| 8 | +// `typecheck` script NAMES it (via `check:test-typecheck --project`), because a |
| 9 | +// config no script invokes is exactly the phantom this whole change is about. |
| 10 | +// |
| 11 | +// ⚠️ WHAT WAS DIFFERENT HERE, and why this package was the worst case in the |
| 12 | +// family rather than one more of it: `service-cluster` had NO `typecheck` |
| 13 | +// script at all — its scripts were `build` and `test`. The other members hid |
| 14 | +// their tests behind an `exclude` in a config some script still ran; this one |
| 15 | +// ran no tsc anywhere. Its build config does NOT exclude tests and never did, |
| 16 | +// so the program that would have read them already existed and simply was |
| 17 | +// never invoked, while turbo/CI typecheck lanes skipped the package silently (a |
| 18 | +// zero-matching filter run exits 0). `tsup` type-strips, `vitest` type-strips. |
| 19 | +// |
| 20 | +// What differs from the build config, and what deliberately does NOT: |
| 21 | +// - MODULE SEMANTICS ONLY, plus `lib`. The tests are written and executed as |
| 22 | +// ESM by vitest (esbuild/vite). Matching that is FIDELITY, not laxity: it is |
| 23 | +// the same subtraction `packages/spec`, `packages/rest` and the |
| 24 | +// `packages/plugins/**` family each made. |
| 25 | +// - ⛔ STRICTNESS IS UNTOUCHED. `strict`, `noUnusedLocals`, |
| 26 | +// `noUnusedParameters`, `noImplicitReturns`, `noFallthroughCasesInSwitch`, |
| 27 | +// `rootDir`, `paths` and `types` are all INHERITED from `tsconfig.json` |
| 28 | +// (and through it the root config), and none of them is re-declared here. |
| 29 | +// ⚠️ A child that declared its own `paths` would REPLACE the parent map |
| 30 | +// rather than merge into it, silently sending a source-resolved specifier |
| 31 | +// back to `dist/` — a BUILD ARTIFACT — so this file declares none. |
| 32 | +// Nothing here may loosen a type rule; if a test does not compile, that is |
| 33 | +// the finding. |
| 34 | +// - `lib: ["ES2022"]`, for the same reason `packages/rest` states: the root |
| 35 | +// config's `lib` is ES2020 and vitest runs on a Node that has es2022 |
| 36 | +// builtins, so the gap is reported as TS2550 about the CHECK. No `DOM`: |
| 37 | +// nothing in this layer touches a browser global. |
| 38 | +// |
| 39 | +// MEASURED at 44ffa2103, workspace closure built first (`tsc --noEmit --pretty |
| 40 | +// false --listFiles -p tsconfig.test.json`, and the same command without |
| 41 | +// `--listFiles`): |
| 42 | +// |
| 43 | +// files in this program 410 |
| 44 | +// own `src/**/*.test.ts` in it 7 |
| 45 | +// errors under BUILD semantics 1 |
| 46 | +// errors under THIS config 1 |
| 47 | +// |
| 48 | +// The two readings agree, so this package carried no config-tier pile at all — |
| 49 | +// the single error is code-tier, and it is REPAIRED in the same PR rather than |
| 50 | +// ledgered. It was a TS2322 at `src/memory/memory.contract.test.ts:26`: |
| 51 | +// `(m) => received.push(m.payload)` passed as a `PubSubHandler`, whose contract |
| 52 | +// return type is `void | Promise<void>`. A concise arrow body returns |
| 53 | +// `Array.prototype.push`'s `number`, and the void-return assignability |
| 54 | +// relaxation does NOT forgive it because the target is a UNION rather than bare |
| 55 | +// `void`. That is the same shape `@objectstack/metadata` graduated on (#14342), |
| 56 | +// and the fix is a block body — the handler is side-effect-only by contract. |
| 57 | +// Triage was explicit that this one is to be fixed, not ledgered. |
| 58 | +// |
| 59 | +// There is NO `test-typecheck-debt.json` beside this config, and its ABSENCE is |
| 60 | +// the zero: `check:test-typecheck` reads a missing ledger as `{ entries: {} }`, |
| 61 | +// under which ANY error in ANY file here is red immediately, with no entry to be |
| 62 | +// added to. That is strictly stronger than a ledger holding nothing, and it is |
| 63 | +// the same call `plugin-webhooks` and `plugin-security` (#13176) each recorded |
| 64 | +// for themselves. If this package ever acquires residue that cannot be fixed in |
| 65 | +// the PR that causes it, THAT is when a ledger and a `gen:test-typecheck-debt` |
| 66 | +// script are owed — and adding one is maintainer-only (#5286), exactly as the |
| 67 | +// gate says when it refuses. |
| 68 | +{ |
| 69 | + "extends": "./tsconfig.json", |
| 70 | + "compilerOptions": { |
| 71 | + "noEmit": true, |
| 72 | + "module": "esnext", |
| 73 | + "moduleResolution": "bundler", |
| 74 | + "lib": ["ES2022"] |
| 75 | + }, |
| 76 | + "include": ["src/**/*"], |
| 77 | + "exclude": ["node_modules", "dist"] |
| 78 | +} |
0 commit comments