microsoft / microsoft/TypeScript
Incorrect diagnostic message in TS2814
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
🔎 Search Terms
2814, function body
🕗 Version & Regression Information
- regression at
v4.4.4.
⏯ Playground Link
💻 Code
// tests/cases/compiler/callOverloads1.ts
class Foo {
bar1() { }
}
function Foo();
//~^ error report: Function with bodies can only merge with classes that are ambient.
🙁 Actual behavior
The function Foo actually has no body (it's just a declaration), yet the error message says "Function with bodies...", which may be a bit confusing.
🙂 Expected behavior
Either show a hint like "Only functions can merge with ambient classes," or suppress the error report for functions without a body because class Foo will report Class declaration cannot implement overload list for 'Foo'.
Additional information about the issue
No response
Guida per i contributori
Apri 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.
Direzione di ricerca
Inizia da tests/cases/compiler/callOverloads1.ts e riproduci la diagnostica TS2814 usando l’esempio Playground fornito. Traccia la diagnostica per una dichiarazione di funzione unita a una classe, quindi scegli e convalida il comportamento relativo al messaggio riportato o alla soppressione descritto nell’issue. Aggiorna le aspettative del test del compilatore in modo che la formulazione errata non venga più accettata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100