A subclass's method is missing natively when the instance is read back from a Set typed with its base class
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.7k
- Forks
- 229
- Merge medio
- 14 h 29 min
- PR fusionados (30 d)
- 787
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de vercel-labs/scriptc
-
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
vercel-labs/scriptc#4864 ·
Los mantenedores suelen responder en 1 día
-
Windows ARM64 as a cross-compile targetPosiblemente ocupada @hum-n la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
vercel-labs/scriptc#4858 ·
Los mantenedores suelen responder en 1 día
-
post-merge-bisect-unresolved
Dificultad 3/5 1-2 días Aptitud para principiantes 43/100
vercel-labs/scriptc#4791 ·
Los mantenedores suelen responder en 1 día
-
post-merge-bisect-unconfirmed
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
vercel-labs/scriptc#4755 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
vercel-labs/scriptc#4634 ·
Los mantenedores suelen responder en 1 día
Todos los issues de vercel-labs/scriptc
Issues similares
-
bug data-types
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
ClickHouse/clickhouse-js#1293 ·
Los mantenedores suelen responder en 1 día
-
area: middleware enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
agent/quality testing
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
juspay/agent-distro#203 ·
Los mantenedores suelen responder en 1 día