Optional JSDoc rejects mandatory JavaScript setter parameters
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js, typescript
调研方向
Start at the setter-parameter preflight gate and the parser representation of optional JSDoc tokens; the issue does not name source files or test paths. Add regression coverage for class and object setters, checked JavaScript, syntax negatives, many setters, and same-filename JSX snapshots, then compare assignments, stored values, descriptors, and side effects with Node. Done means comment-only optional annotations pass while executable setter restrictions and caller checks remain intact.
由索引模型根据 Issue 内容生成。
描述
The generated Symbolic bindings used by the full Sentry CLI document several JavaScript setter parameters as optional in JSDoc. The executable parameters themselves are mandatory. Node accepts these setters, but scriptc rejects them before lowering.
This follows up on #3036 and #3044. They were closed as fixed by #3112, but that merged diff contains the regex change; current main still rejects this example:
class Store {
constructor() { this.stored = null; }
/** @param {string | null} [next] */
set value(next) { this.stored = next; }
}
const store = new Store();
store.value = "kept";
console.log(store.stored);
Node prints kept. scriptc reports SC0001: A 'set' accessor cannot have an optional parameter. The diagnostic points into the JSDoc comment, not an executable ? parameter. The same problem occurs for object-literal setters and with // @ts-check.
The parser represents the optional JSDoc annotation with a synthetic optional token, and the preflight gate treats it as executable setter syntax. The full CLI currently has five instances of this diagnostic in Symbolic's generated bindings.
The requested fix should admit this comment-only JavaScript case while preserving errors for real optional, default, rest, or multiple setter parameters and keeping caller type checks and reflective argument-count restrictions intact.
A dependency can contain many documented setters, so eligibility should not rescan the whole file for every diagnostic. A per-preflight index keyed by SourceFile identity can collect attached comment spans once and find a containing span with binary search. SourceFile identity matters because original and rewritten JSX snapshots can share a filename but have different offsets.
Regression coverage should include class and object setters, checked JavaScript, the real syntax negatives, many setters, and JSX snapshots sharing a filename. Native differential coverage should check assignments, stored values, descriptor behavior, and observable side effects against Node.
Reproduced with scriptc 0.4.9 built from current main and Node 24.22.1. The current-main positive setter tests fail with TS1051 before any production change. Related earlier work: #3036, #3044, #3112.
- 主要语言
- TypeScript
- 星标
- 6.5k
- 派生
- 212
- 平均合并
- 13 小时 2 分钟
- 30 天内合并 PR
- 798
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vercel-labs/scriptc 的其他 Issue
-
Discarded negation of a void call rejects valid JavaScript可能已有人在做 @MathurAditya724 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 1/100
vercel-labs/scriptc#3358 ·
维护者通常 1 天内回复
-
Correct JavaScript refusal descriptions for mutable bindings and missing properties可能已有人在做 @MathurAditya724 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
vercel-labs/scriptc#3354 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
vercel-labs/scriptc#3330 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
vercel-labs/scriptc#3210 ·
维护者通常 1 天内回复
-
Abstract methods block coverage and direct calls when no subclass exists可能已有人在做 @alantriesagain 于 2 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 25/100
vercel-labs/scriptc#3077 ·
维护者通常 1 天内回复
查看 vercel-labs/scriptc 的全部 Issue
相似的 Issue
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
难度 2/5 1-3 小时 新手友好度 68/100
openclaw/openclaw#195577 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
EKKOLearnAI/ekko-studio#3729 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 78/100
Supportseal/SupportSeal-app#98 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
eliasstravik/herdr-projects#845 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
cloudflare/skills#279 ·
维护者通常 1 天内回复