Optional setter JSDoc is mistaken for optional executable syntax

クローズ
#3,036 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #3044 @MathurAditya724 による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript, wasm
領域
compilers

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
6.5k
フォーク
212
平均マージ
13時間 2分
マージ済み PR(30日)
798

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vercel-labs/scriptc のほかの issue

vercel-labs/scriptc の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。