Summary
Split out from #1767 (the third of its three bullets) during the tidy-bundle PR that closed the rest. The cli and tui typecheck scripts (tsc --noEmit -p tsconfig.json, added in #1689) include only src and exclude **/*.test.{ts,tsx}, so the __tests__ dirs — which do the most as casting — get no tsc pass. web already typechecks its tests via tsc -b.
A spike (adding a tsconfig.test.json per client that includes __tests__ with the test-exclusions removed, and running tsc --noEmit on it) surfaces 76 errors — cli 58, tui 18 — which is why this was carved out of the tidy bundle rather than rushed:
cli: 24× TS7006 (implicit any params)
19× TS2345 (partial mocks passed where InspectorClient / InspectorServerSettings expected)
15× TS2307 (test-only module aliases tsc doesn't resolve:
@modelcontextprotocol/inspector-test-server, @inspector/core/mcp/index.js)
tui: 6× TS2322, 5× TS2556, 4× TS2345, 1× TS2741, 1× TS2739, 1× TS2353
Proposed
- Add a
tsconfig.test.json to clients/cli and clients/tui that inherits the base compilerOptions, includes __tests__/**/*, and drops the **/*.test.* exclusions. Add the test-only path aliases (@modelcontextprotocol/inspector-test-server, the @inspector/core/* deep paths) so tsc resolves what vitest resolves via resolve/projectResolve.
- Fold
tsc --noEmit -p tsconfig.test.json into each client's typecheck (it already runs the src-only config).
- Fix what it surfaces. The implicit-anys are trivial annotations; the alias errors are the config above; the partial-mock
TS2345s should be fixed with typed mock factories where practical rather than a spray of as unknown as casts (per the AGENTS.md as-cast policy) — a shared makeFakeInspectorClient() / makeFakeServerSettings() helper is likely the right shape.
Notes
Summary
Split out from #1767 (the third of its three bullets) during the tidy-bundle PR that closed the rest. The cli and tui
typecheckscripts (tsc --noEmit -p tsconfig.json, added in #1689)includeonlysrcandexclude**/*.test.{ts,tsx}, so the__tests__dirs — which do the mostascasting — get notscpass. web already typechecks its tests viatsc -b.A spike (adding a
tsconfig.test.jsonper client that includes__tests__with the test-exclusions removed, and runningtsc --noEmiton it) surfaces 76 errors — cli 58, tui 18 — which is why this was carved out of the tidy bundle rather than rushed:Proposed
tsconfig.test.jsontoclients/cliandclients/tuithat inherits the base compilerOptions,includes__tests__/**/*, and drops the**/*.test.*exclusions. Add the test-only path aliases (@modelcontextprotocol/inspector-test-server, the@inspector/core/*deep paths) sotscresolves what vitest resolves viaresolve/projectResolve.tsc --noEmit -p tsconfig.test.jsoninto each client'stypecheck(it already runs the src-only config).TS2345s should be fixed with typed mock factories where practical rather than a spray ofas unknown ascasts (per the AGENTS.mdas-cast policy) — a sharedmakeFakeInspectorClient()/makeFakeServerSettings()helper is likely the right shape.Notes
tsconfig.test.json+ the&& tsc -p tsconfig.test.jsonwiring) was prototyped and reverted in the Close remaining quality-gate gaps: web/server + root-file format, cli/tui __tests__ typecheck #1767 tidy PR — reuse it as the starting point.