Optional setter JSDoc is mistaken for optional executable syntax

Abierto
#3,036 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 5/11/2026.

  • #3044 de @MathurAditya724 — abierto

Evaluación

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

Línea de trabajo

Start with the JSDoc setter parameter handling that emits TS1051, then inspect the setter lowering and regression tests; the issue names no source files or test entry points. Reproduce with the setter.mjs example and compare against Node 24.22.1. Done means optional JSDoc names no longer change setter arity, executable optional and rest forms still receive their existing refusals, and regression tests cover accessors, arguments, inheritance, and native behavior.

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

Descripción

We are compiling the full Sentry CLI with scriptc while retaining the Symbolic WASM wrapper used for debug-file handling. Five generated setters are rejected because their JSDoc marks the accepted value as optional, even though each executable setter has one ordinary parameter.

A reduced example is:

class Box {
  /** @param {string | null} [next] */
  set value(next) {
    console.log(next);
  }
}
new Box().value = null;

Save this as setter.mjs. Node 24.22.1 prints null. scriptc built from current main reports A 'set' accessor cannot have an optional parameter (TS1051 / SC0001). The diagnostic points inside [next] in the comment. There is no optional parameter token in the setter's executable syntax.

Expected behavior is to distinguish erased JSDoc optionality from an actually optional setter parameter. The comment should not change the setter's declared arity, and ordinary property assignments of null or undefined should follow the same runtime behavior as Node. The existing refusals for executable setter parameter forms should remain unchanged by this comment-specific fix. This includes optional and rest syntax, and the separate default-initializer case that scriptc does not yet lower exactly. Authored TypeScript checks should also remain intact.

The generated wrapper includes getter/setter pairs, so accepting the comment alone is not enough: regression tests should check setter-only properties, matching getter/setter pairs, argument handling and inheritance, with native differential execution. Any signature normalization must preserve the actual read and write behavior.

I checked existing work before filing. #2758 handles TS7032 for unannotated setters, while #2927 discusses the separate TS1052 default-initializer case. Neither addresses TS1051 inside an optional JSDoc name. Resolving this case removes the first five observed setter diagnostics, rather than proving that every later WASM-wrapper path works.

Lenguaje dominante
TypeScript
Estrellas
6.4k
Forks
204
Merge medio
7 h 45 min
PR fusionados (30 d)
845

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.