Correct JavaScript refusal descriptions for mutable bindings and missing properties

Abierto
#3,354 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@MathurAditya724 ya está trabajando en esto.

Desde el 7/11/2026.

  • #3356 de @MathurAditya724 — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
node.js, typescript

Línea de trabajo

Read the refusal descriptions and preflight regression tests for TS2629, TS2630, and TS2739; the issue does not name their file paths. Start by running the existing preflight diagnostics for the four examples in the issue. Done when the descriptions accurately cover ordinary object shape and mutable declaration bindings, distinguish named function expression behavior, preserve diagnostic codes and admission decisions, and the regression tests exercise actual preflight diagnostics.

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

Descripción

While compiling the full Sentry CLI and its JavaScript dependencies, several refusals describe different JavaScript behavior from the code being rejected. This makes it difficult to tell whether a dependency is invalid or scriptc needs additional lowering support.

This follows up on #3037 and #3039. Those were closed as fixed by #3112, but that PR's merged diff contains the regex change; these three descriptions are still unchanged on current main.

For example, save either example as example.mjs:

class Value {}
Value = class Replacement {};
console.log(Value.name);

Node prints Replacement. scriptc refuses the assignment and says the class binding is read-only and Node throws a TypeError (TS2629). A class declaration has a mutable outer binding; the class's inner binding is a separate immutable binding.

function value() { return 1; }
value = () => 2;
console.log(value());

Node prints 2, including in a module. scriptc's TS2630 hint instead says Node throws a TypeError in strict mode and modules. A function declaration is mutable; a named function expression's inner binding has different assignment behavior.

There is also a misleading TS2739 description:

// @ts-check
/** @type {{ first: string, second: string, third: string }} */
export const value = { first: "one" };

scriptc describes this as a set-like argument missing has and size. This example has no Set operation; it is an ordinary value missing properties required by its target type.

The requested fix is limited to accurate refusal descriptions. It should preserve the diagnostic codes and admission decisions, distinguish mutable declaration bindings from immutable inner bindings, and describe TS2739 without assuming a Set protocol. Regression tests should exercise actual preflight diagnostics rather than just checking the table's source text.

Reproduced with scriptc 0.4.9 built from current main and Node 24.22.1. Four real preflight regression cases fail with the current descriptions: ordinary object shape, function declaration, class declaration, and named function expression. Related earlier work: #3037, #3039, #3112.

Lenguaje dominante
TypeScript
Estrellas
6.5k
Forks
212
Merge medio
13 h 2 min
PR fusionados (30 d)
798

Preparar el entorno

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.