Abstract methods block coverage and direct calls when no subclass exists
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- compilers
Direzione di ricerca
Start by reading the compiler paths that handle abstract method declarations, untyped property lookup, and direct calls; the issue gives reproductions but names no source files or tests. Compare the two examples with Node and inspect the existing SC1090 handling. Done means coverage treats abstract declarations as having no runtime value and direct calls match Node’s receiver, argument, and TypeError behavior. A linked pull request is already open.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Abstract methods block coverage and direct calls when no subclass exists
The compiler refuses or defers abstract methods in two shapes that JavaScript handles.
Untyped lookup
A value held as any whose instances reach o[k] gets a branch per class and member. For an abstract method, the branch asks for the method's value, which an abstract declaration does not have. Every such branch is deferred with SC1090 values of abstract method declarations. The program runs and matches Node, but coverage never reports it as fully static.
abstract class Holder {
abstract current(): string;
}
class Impl extends Holder {
current(): string {
return "ok";
}
}
const read = (o: any, k: string) => o[k];
const impl: Holder = new Impl();
console.log(read(impl, "current"), impl.current());
On 0.4.8, scriptc coverage of the larger form in our corpus (abstract-methods-untyped-lookup.ts) reports 6 deferred sites. The same failure reproduces on main (979a65246).
Direct call
A concrete method that calls an abstract method with no concrete implementation below the receiver's static class is refused at build time, even when the program never subclasses the class. tsc makes every instantiable subclass implement the method, so no instance can reach the call.
abstract class Source {
abstract count(): number;
liveFrom(): number {
return this.count();
}
}
class Shelf {
source: Source | null = null;
}
const shelf = new Shelf();
console.log(shelf.source === null ? "none" : shelf.source.liveFrom());
Node prints none. On 0.4.8, the build fails with SC1090 calls of the abstract method 'count' with no concrete implementation below the receiver's static class.
An abstract declaration has no value at run time. An untyped lookup should select the implementation of the constructible subclass the instance belongs to, nearest first, and read undefined when no class below the receiver implements it. A direct call should evaluate its receiver and arguments, then throw Node's TypeError, <callee> is not a function.
I opened #TBD with a patch that implements both behaviors.
- Lingua principale
- TypeScript
- Stelle
- 6.4k
- Fork
- 204
- Merge medio
- 9h 48m
- PR unite (30g)
- 795
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vercel-labs/scriptc
-
Promise.all result is treated as possibly undefined, widening mapped rowsForse già presa @alantriesagain l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 47/100
vercel-labs/scriptc#3080 ·
I maintainer di solito rispondono entro 1 giorno
-
Async function with a typed result rejects a returned checked-dynamic promiseForse già presa @alantriesagain l’ha presa oggi. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 48/100
vercel-labs/scriptc#3078 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
vercel-labs/scriptc#3048 ·
I maintainer di solito rispondono entro 1 giorno
-
Assigning a wide Node object (process.stdout) to a narrow { write } record fails SC2002 (width-copy rules)Forse già presa @ctate l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
vercel-labs/scriptc#2949 ·
I maintainer di solito rispondono entro 1 giorno
-
Analysis OOM (exit 137 at ~4 GB) on large TypeScript graphsForse già presa @espetro l’ha presa 3 giorni fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 12/100
vercel-labs/scriptc#2916 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel-labs/scriptc
Issue simili
-
bug needs-triage potential-regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws/aws-sdk-js-v3#8408 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
colinhacks/zod#6743 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Packing list: the weight field drops digits on a slow connection and saves the wrong weightAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
openai/openai-node#3124 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
anthropics/anthropic-sdk-typescript#1296 ·
I maintainer di solito rispondono entro 8 giorni