Deno: TS2307 on all .js subpath imports — './*' exports map types to '*.js.d.ts'
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- deno, typescript
- Área
- build-system, tooling
Línea de trabajo
Comienza con el mapa de exportaciones del paquete y reproduce el fallo usando el mod.ts proporcionado y el comando deno check. Verifica que el patrón de subruta .js resuelve las declaraciones en Deno y, después, confirma que las comprobaciones existentes de tsc y Node siguen pasando sin afectar a las entradas ./*.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Under Deno, every .js-suffixed subpath import of the SDK fails type resolution with TS2307, because the ./* export pattern maps types to ./dist/esm/*.d.ts. For the specifier @modelcontextprotocol/sdk/server/mcp.js, * captures server/mcp.js, so the types path resolves to dist/esm/server/mcp.js.d.ts — which does not exist. The real declaration file is dist/esm/server/mcp.d.ts.
tsc resolves this fine (it strips the .js before matching), so the problem is invisible to Node-only users. Deno applies the substitution literally and fails.
This affects the import style used throughout the SDK's own README and examples, so it hits essentially any MCP server that tries to type-check under Deno or publish to JSR.
Reproduction
Clean directory, no tsconfig:
mkdir repro && cd repro
echo '{"name":"repro","type":"module","dependencies":{"@modelcontextprotocol/sdk":"1.30.0"}}' > package.json
npm install
echo '{"nodeModulesDir":"manual"}' > deno.json
printf 'import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";\nexport const s: McpServer | null = null;\n' > mod.ts
deno check mod.ts
Result:
Check mod.ts
TS2307 [ERROR]: Cannot find module '@modelcontextprotocol/sdk/server/mcp.js'.
at file:///.../repro/mod.ts:1:27
error: Type checking failed.
The identical file under tsc 5.9.3 exits 0:
tsc --noEmit --module nodenext --moduleResolution nodenext --strict mod.ts # exit 0
Why it's worse than one error
Once McpServer is unresolved, the zod-inferred parameter types on every server.tool(...) callback collapse to any. In a real server this cascades: a file of mine with 3 SDK imports produced 1 × TS2307 plus 19 × TS7031 ("Binding element 'sessionId' implicitly has an 'any' type"), all downstream of the single resolution failure. The error output makes it look like a codebase problem rather than a one-line packaging one.
Versions
@modelcontextprotocol/sdk1.30.0- Deno 2.9.0 (stable, x86_64-unknown-linux-gnu)
- TypeScript 5.9.3
- Node 24
Suggested fix
Add a ./*.js pattern alongside the existing ./*. Node's exports resolution prefers the more specific pattern, so ordering doesn't matter and existing consumers are unaffected:
"./*.js": {
"types": "./dist/esm/*.d.ts",
"import": "./dist/esm/*.js",
"require": "./dist/cjs/*.js"
},
"./*": {
"types": "./dist/esm/*.d.ts",
"import": "./dist/esm/*",
"require": "./dist/cjs/*"
}
I verified this against 1.30.0 by patching node_modules:
deno check mod.ts→ exit 0node --input-type=module -e 'import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; ...'→ still resolves,typeof McpServer === "function"
So it fixes Deno without regressing Node.
Note on prior art
#1269 ("Non-Node environment support (Bun, Deno, React Native)") was closed as completed in March, but this type-resolution path appears not to be covered by it — runtime import works under Deno, only type-checking fails. Happy to open a PR if the suggested shape looks right.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13.5k
- Forks
- 2.3k
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 55
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/typescript-sdk
-
v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/typescript-sdk#2946 ·
Los mantenedores suelen responder en 1 día
-
[v2] URI template reserved expansions encode existing %HH sequences againPosiblemente ocupada @takagibit18 la tomó hace 4 días. Abiertov1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
modelcontextprotocol/typescript-sdk#2920 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[v2] URI template strict expansions leave !'()* unencodedPosiblemente ocupada @takagibit18 la tomó hace 4 días. Abiertov1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
modelcontextprotocol/typescript-sdk#2919 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Malformed params on spec request methods return -32603 Internal error instead of -32602 Invalid paramsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertov1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
modelcontextprotocol/typescript-sdk#2916 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Unconditional `prompt=consent` (when `offline_access` in scope) blocks OAuth in Entra tenants with user consent disabled + admin consent grantedPosiblemente ocupada @dasjideepak la tomó hace 10 días. Abiertov1 v2
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
modelcontextprotocol/typescript-sdk#2867 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/typescript-sdk
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Comfy-Org/ComfyUI_frontend#20346 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
decentralized-identity/didwebvh-ts#203 ·
Los mantenedores suelen responder en 1 día
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
lingdojo/kana-dojo#31791 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
Telegram webhook: line breaks lost since switch to rich messagesPosiblemente ocupada @Kshot3000 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
github_actions security
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día