Skip to content

Commit ec63d41

Browse files
yinlianghuiclaude
andauthored
fix(plugin-map): type-check its tests and clear its TEST_DEBT entry (#4040) (#4270)
`packages/plugin-map` gains a `tsconfig.test.json` on the objectui#3032 template, chained from its `type-check` script, so its four test files are compiled by something for the first time. Its one declared code-tier error was config-tier under a fuller template: TS2882 on `ObjectMap.tsx`'s side-effect import of maplibre's CSS, raised only because `src/global.d.ts` — which declares `*.css` — was not a program input. An ambient declaration is a program input only when a pattern names it; being reachable by import is not enough, since nothing imports it. No source changed. Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3 Co-authored-by: Claude <noreply@anthropic.com>
1 parent a43ff87 commit ec63d41

4 files changed

Lines changed: 47 additions & 2 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
---
3+
4+
Releases nothing on purpose: `@object-ui/plugin-map` now type-checks its four test files
5+
(`tsconfig.test.json` chained from `type-check`), and its `TEST_DEBT` entry is gone. No
6+
published source changed.
7+
8+
Its one declared code-tier error turned out to be config-tier under a fuller template,
9+
the same reclassification `sdui-parser`'s 50 `TS2304`s got in objectui#3032. The error was
10+
`TS2882` on `ObjectMap.tsx`'s side-effect import of `maplibre-gl/dist/maplibre-gl.css` —
11+
raised not because the source is wrong (the package build compiles it cleanly) but because
12+
`src/global.d.ts`, which declares `*.css`, was not a program input. An ambient declaration
13+
file is only an input when a pattern NAMES it; being reachable by import is not enough,
14+
since nothing imports it. `"src/**/*.d.ts"` in the project's `include` is the fix, and it
15+
is the general shape for any package whose build gets ambient declarations for free from
16+
`"include": ["src"]`.

‎packages/plugin-map/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"build": "vite build",
2828
"test": "vitest run",
2929
"test:watch": "vitest",
30-
"type-check": "tsc --noEmit",
30+
"type-check": "tsc --noEmit && tsc -p tsconfig.test.json",
3131
"lint": "eslint ."
3232
},
3333
"dependencies": {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
// Type-checks this package's TESTS, which `tsconfig.json` excludes.
3+
// See `packages/types/tsconfig.test.json` for why that exclusion was a hole:
4+
// the build correctly keeps tests out of `dist`, but nothing else compiled
5+
// them, so a test could assert a contract the compiler never checked.
6+
"extends": "../../tsconfig.json",
7+
"compilerOptions": {
8+
"noEmit": true,
9+
// The package build emits `dist`; this project emits nothing, so it must
10+
// not inherit `composite` / `declaration` from the build config.
11+
"composite": false,
12+
// The `toBeInTheDocument` / `toHaveTextContent` matchers these tests use are
13+
// a global augmentation, not an import, and `@testing-library/jest-dom` does
14+
// not live under `@types/` — so it is never picked up automatically and has
15+
// to be named here. Naming `types` at all switches off automatic `@types/*`
16+
// inclusion, which is fine: nothing in these tests touches Node globals.
17+
"types": ["@testing-library/jest-dom"],
18+
// Drop the root tsconfig's source-tree `paths` so `@object-ui/*` and
19+
// `@objectstack/spec` resolve through the workspace dependency's built
20+
// `.d.ts` instead of pulling sibling sources in as program inputs (TS6059).
21+
"paths": {}
22+
},
23+
// `src/global.d.ts` is pulled in explicitly. The build program gets it for
24+
// free from `"include": ["src"]`, but an ambient declaration file is only a
25+
// program input when a pattern names it — being imported is not enough,
26+
// because nothing imports it. Without it `ObjectMap.tsx`'s side-effect import
27+
// of `maplibre-gl/dist/maplibre-gl.css` is TS2882 here and nowhere else,
28+
// which reads as a defect in the source the build compiles cleanly.
29+
"include": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"]
30+
}

‎scripts/check-type-check-coverage.mjs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export const TEST_DEBT = {
129129
"@object-ui/auth": { errors: 2, issue: 4118 },
130130
"@object-ui/plugin-chatbot": { errors: 2, issue: 4118 },
131131
"@object-ui/plugin-grid": { errors: 2, issue: 4118 },
132-
"@object-ui/plugin-map": { errors: 1, issue: 4118 },
133132
};
134133

135134
// ── Collect workspace packages ───────────────────────────────────────────────

0 commit comments

Comments
 (0)