Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

pnpm -r typecheck silently skips the three test packages, hiding 35 type errors and one registerPrompt typing defect

クローズ
#2,840 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 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 の本文から書いたものです。

説明

v2
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:

  1. Add the missing typecheck script (and the @typescript/native-preview devDependency it needs) to the three packages, so pnpm -r typecheck actually covers them.
  2. Fix the resulting test-side type errors.
  3. Add an argsSchema?: undefined overload typing the callback as PromptCallback, 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/typescript-sdk のほかの issue

modelcontextprotocol/typescript-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。