SC9001 "missing method function toString" when the entry exports a class whose `toString` nothing calls
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
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- compilers
Línea de trabajo
Start by tracing the compiler path that handles exported classes and the %util.clsString call; the issue also points to the related %dyn.class.protocol report in #3503. Reproduce with the provided index.ts and npx [email protected] build index.ts, then compare the exported class case with the listed variants that compile. Done means the entry compiles without either SC9001 error.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
scriptc 0.4.14 crashes on an entry module that exports a class with its own toString when the program never calls that method.
Reproduction
package.json:
{ "type": "module" }
index.ts:
export class U {
toString(): string {
return 'u';
}
}
npx [email protected] build index.ts
Observed
index.ts:1:1 - error SC9001: internal compiler error: class U: missing method function "toString" — please report this
index.ts:1:1 - error SC9001: internal compiler error: in %util.clsString.5f569930a64f: call to undeclared function "%U.toString" — please report this
2 errors.
The same errors appear with export default class U, with an unexported class returned from an exported factory (export const make = () => new U();), and with --emit obj.
Expected
The module compiles.
These variants compile:
- The program calls the method:
export class U { ... }followed byconsole.log(new U().toString());. - The class is not exported and the entry uses it locally, for example
console.log(new U() instanceof U);. - The method has another name, such as
describe(), or isvalueOf(). - The entry exports an instance:
export const u = new U();. - Another module imports
Uand the entry exports nothing from it.
#3503 reported an SC9001 for toString reached through %dyn.class.protocol in 0.4.10. This one goes through %util.clsString and needs no interface.
Context
JSPrismarine hits this when building a package entry on its own: UUID in @jsprismarine/protocol and ServerName in @jsprismarine/raknet export classes like this (https://github.com/JSPrismarine/JSPrismarine/issues/3323).
Environment
- scriptc 0.4.14 from npm
- Linux x86_64, glibc 2.43
- Node.js 26.13.0
- 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#4865 ·
Los mantenedores suelen responder en 1 día
-
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
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