pnpm -r typecheck silently skips the three test packages, hiding 35 type errors and one registerPrompt typing defect
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start with the package manifests and scripts in test/conformance, test/helpers, and test/integration, then run pnpm -r typecheck to reproduce the skipped checks. Inspect McpServer.registerPrompt and createPromptHandler for the no-args callback typing. Done means every workspace typechecks cleanly, the reported errors are fixed, and the full test suite passes.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
pnpm check:all runs pnpm -r typecheck, and pnpm silently skips workspace packages that do not define the script. Three do not:
@modelcontextprotocol/test-conformance@modelcontextprotocol/test-helpers@modelcontextprotocol/test-integration
All three define a check script that calls npm run typecheck, so the intent was clearly for them to be typechecked. The script just does not exist, and both pnpm and npm treat a missing script in a recursive run as a no-op rather than an error. So the gap is invisible: pnpm -r typecheck exits 0 today while never looking at those packages.
To Reproduce
On main:
$ pnpm -r typecheck
... examples typecheck: Done # exits 0, no mention of the three test packages
Then add "typecheck": "tsgo -p tsconfig.json --noEmit" to any of the three and re-run. Errors appear immediately.
Running the compiler against them directly, without changing anything:
$ cd test/conformance && tsgo -p tsconfig.json --noEmit | grep -c 'error TS'
1
$ cd test/integration && tsgo -p tsconfig.json --noEmit | grep -c 'error TS'
34
$ cd test/helpers && tsgo -p tsconfig.json --noEmit | grep -c 'error TS'
0
35 type errors currently sit in the repository with CI green.
Expected behavior
pnpm check:all typechecks every workspace package, including the test packages, so type errors in them fail CI.
One of the 35 is a real API defect, not test drift
Most of the 34 in test/integration are test-side type drift. One is not.
McpServer.registerPrompt() has two public overloads, and both constrain Args to a schema type. But when config carries no argsSchema, createPromptHandler takes its else branch and invokes the callback as callback(ctx) — the server context is the only argument. No overload describes that shape, so the argument-less form falls through to the deprecated raw-shape signature and types the first parameter as the arguments record.
The practical result: a callback that reads ctx.mcpReq does not compile, even though it works correctly at runtime. An explicit PromptCallback annotation does not rescue it either, because that also fails to match either overload. The only caller of this form in the repo lives in test/integration, which is exactly the package that was never typechecked — so the defect has been invisible since it was introduced.
Proposed fix
Three commits, kept separable for review:
- Add the missing
typecheckscript (and the@typescript/native-previewdevDependency it needs) to the three packages, sopnpm -r typecheckactually covers them. - Fix the resulting test-side type errors.
- Add an
argsSchema?: undefinedoverload typing the callback asPromptCallback, and widen the implementation signature. Callbacks declaring no parameters already compiled and are unaffected, as is every schema-bearing form.
After: pnpm -r typecheck is clean across every package, and the full suite passes (4256 tests, plus 2788 e2e unaffected). A changeset is included for the registerPrompt fix since it changes public types.
I have this ready and can open the PR if you want it. Filing the issue first because it touches build configuration across multiple packages and changes a public overload set, which reads as "significant" under CONTRIBUTING.md.
I used an AI assistant while investigating; I have read the diff, run the suites, and can explain and defend the change in review.
Additional context
main @ 2a14dd8. pnpm test:conformance:server could not run on my machine (it needs a browser-capable environment); the identical failure reproduces on a clean checkout, so it is unrelated to the change.
- 主要言語
- TypeScript
- スター
- 13.5k
- フォーク
- 2.3k
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 52
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/typescript-sdk のほかの issue
-
Stateless 405 response omits the Allow header対応中かも @jstar0 が 2 日前に担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/typescript-sdk#2970 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[v2] @modelcontextprotocol/server inlines fast-uri 3.1.0, which has 9 published advisories対応中かも @Andiii208 が 2 日前に担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#2966 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#2946 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
[v2] URI template reserved expansions encode existing %HH sequences again対応中かも @takagibit18 が 9 日前に担当しました。 オープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/typescript-sdk#2920 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[v2] URI template strict expansions leave !'()* unencoded対応中かも @takagibit18 が 9 日前に担当しました。 オープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/typescript-sdk#2919 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/typescript-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JoviDeCroock/pracht#432 ·
メンテナーはふだん 1 日以内に返信
-
approved check:passed streams:add
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Hardware attribute name "app Connection Support" has inconsistent casing対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
walletbeat/walletbeat#1628 ·
メンテナーはふだん 1 日以内に返信
-
bug go
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
genkit-ai/genkit#6761 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NousResearch/hermes-agent#136483 ·
メンテナーはふだん 1 日以内に返信