Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

dynamic: `.ts` sources in embedded npm packages are not type-stripped — binary fails with SyntaxError at startup

Abierto
#575 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
node.js, typescript
Área
compilers

Línea de trabajo

Start by reproducing the failure with build --dynamic and the minimal package.json, node_modules/tsdep/index.ts, and main.ts example. Trace how .ts files selected through npm exports enter the embedded npm graph and reach the engine. Done means erasable TypeScript syntax is stripped before execution, or the build emits a diagnostic instead of producing a failing binary.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

build --dynamic succeeds for a program that imports an npm package whose exports point at TypeScript sources (.ts), but the embedded engine receives the .ts source without type stripping. The binary then fails at startup with a SyntaxError on the first type annotation. There's no diagnostic at build time.

This affects real packages that ship .ts entry points. For example [email protected] has "exports": { ".": { "import": "./index.ts" } }, and the binary fails with Uncaught SyntaxError: Unexpected identifier 'AgentToolUpdateCallback' (from import { withFileMutationQueue, type AgentToolUpdateCallback, ... } from "@earendil-works/pi-coding-agent"). #470 fixed the checker side of .ts-shipping dependencies; this is the runtime side.

Reproduction
// package.json
{ "name": "r", "type": "module" }
// node_modules/tsdep/package.json
{ "name": "tsdep", "type": "module", "exports": { ".": { "types": "./index.ts", "import": "./index.ts", "default": "./index.ts" } } }
// node_modules/tsdep/index.ts
export function get(): number { return 42; }

// main.ts
import { get } from "tsdep";
console.log(`${get()}`);
$ scriptc build --dynamic -o ./r main.ts   # exit 0
$ ./r
Uncaught SyntaxError: Unexpected token ':'
$ echo $?
1

Variants that fail the same way:

  • import { value, type Shape } from "lib"; gives Unexpected identifier 'Shape'
  • import type { Shape } from "lib"; gives from clause expected

Expected: .ts modules in the embedded npm graph are type-stripped (erasable syntax, as with tsx / node --strip-types) before they reach the engine. If that isn't supported, the build should fail with a diagnostic instead of producing a binary that can't start.

Versions

Reproduced on scriptc 0.1.7 (npm) and on main at 0d9d946 (built from source), linux-x64-gnu, Node 26.10.0.

Lenguaje dominante
TypeScript
Estrellas
5.1k
Forks
130
Merge medio
1 h 13 min
PR fusionados (30 d)
254

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vercel-labs/scriptc

Todos los issues de vercel-labs/scriptc

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.