Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#2,840 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
13.5k
Fork
2.3k
Merge medio
1g 22h
PR unite (30g)
52

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/typescript-sdk

Tutte le issue di modelcontextprotocol/typescript-sdk

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.