pnpm -r typecheck silently skips the three test packages, hiding 35 type errors and one registerPrompt typing defect
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
- Ambito
- backend-api-design, build-system, testing
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
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.
- Lingua principale
- TypeScript
- Stelle
- 13.5k
- Fork
- 2.3k
- Merge medio
- 1g 22h
- PR unite (30g)
- 52
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/typescript-sdk
-
Stateless 405 response omits the Allow headerForse già presa @jstar0 l’ha presa 2 giorni fa. Apertav2
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
modelcontextprotocol/typescript-sdk#2970 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[v2] @modelcontextprotocol/server inlines fast-uri 3.1.0, which has 9 published advisoriesForse già presa @Andiii208 l’ha presa 1 giorno fa. Apertav2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/typescript-sdk#2966 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
v1 v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/typescript-sdk#2946 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[v2] URI template reserved expansions encode existing %HH sequences againForse già presa @takagibit18 l’ha presa 8 giorni fa. Apertav1 v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
modelcontextprotocol/typescript-sdk#2920 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[v2] URI template strict expansions leave !'()* unencodedForse già presa @takagibit18 l’ha presa 8 giorni fa. Apertav1 v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
modelcontextprotocol/typescript-sdk#2919 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelcontextprotocol/typescript-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cameri/nostream#811 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug p3 triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
bug javascript P2-medium python release:v3.1
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
adrirubio/claude-deck#546 ·
I maintainer di solito rispondono entro 1 giorno
-
area: desktop area: website priority: P2 type: feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
appandflow/stim#3411 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
rjsf-team/react-jsonschema-form#5485 ·
I maintainer di solito rispondono entro 2 giorni