A subclass's method is missing natively when the instance is read back from a Set typed with its base class
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
調査の方向性
Start by tracing how scriptc compiles typed JavaScript Set values and preserves subclass methods; the report reproduces this in dm3.js with allowJs, checkJs and strict. Compare the native output with Node.js and the build without checkJs to narrow down where the method is lost. Done means the compiled reproduction calls Effect._schedule() and prints effect without a runtime error.
索引モデルが issue の本文から書いたものです。
説明
An override is lost natively when the instance is read back from a Set typed with its base class: calling the method throws TypeError: ... is not a function. The build reports no diagnostic.
Reproduction
dm3.js, built with a tsconfig that has allowJs, checkJs and strict:
class Reactive {
_schedule() { console.log("reactive"); }
}
class Effect extends Reactive {
_schedule() { console.log("effect"); }
}
class Dep {
constructor() {
/** @type {Set<Reactive>} */
this._subscribers = new Set();
}
/** @param {Reactive} w */
_add(w) { this._subscribers.add(w); }
_notify() {
for (const r of Array.from(this._subscribers)) r._schedule();
}
}
const d = new Dep();
d._add(new Effect());
d._notify();
| Output | Exit | |
|---|---|---|
| Node.js v25.3.0 | effect |
0 |
| scriptc 0.4.12, 0.4.16 and 0.5.0 | Uncaught TypeError: r._schedule is not a function |
1 |
Without checkJs (no JSDoc types reaching the compiler) it prints effect. Neither _schedule is called: the method is missing altogether, not dispatched to the base class.
Environment
Linux x86_64, glibc 2.39, scriptc's linux-x64-gnu packages from npm.
Found through light's probe packages/light/native/probes/p-d-signals.js (a signal library's subscribers kept in a Set of the base class), which fails the same way.
- 主要言語
- TypeScript
- スター
- 6.7k
- フォーク
- 229
- 平均マージ
- 14時間 29分
- マージ済み PR(30日)
- 787
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vercel-labs/scriptc のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
vercel-labs/scriptc#4864 ·
メンテナーはふだん 1 日以内に返信
-
Windows ARM64 as a cross-compile target対応中かも @hum-n が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
vercel-labs/scriptc#4858 ·
メンテナーはふだん 1 日以内に返信
-
post-merge-bisect-unresolved
難易度 3/5 1〜2日 初心者へのやさしさ 43/100
vercel-labs/scriptc#4791 ·
メンテナーはふだん 1 日以内に返信
-
post-merge-bisect-unconfirmed
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
vercel-labs/scriptc#4755 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
vercel-labs/scriptc#4634 ·
メンテナーはふだん 1 日以内に返信
vercel-labs/scriptc の issue をすべて見る
似ている issue
-
bug data-types
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ClickHouse/clickhouse-js#1293 ·
メンテナーはふだん 1 日以内に返信
-
area: middleware enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
agent/quality testing
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
juspay/agent-distro#203 ·
メンテナーはふだん 1 日以内に返信