microsoft / microsoft/TypeScript
Typescript Autocompletion Not Working For Function Overloads
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
From @MartinLoeper on August 29, 2018 13:27
- VSCode Version: 1.25.1 1dfc5e557209371715f655691b1235b6b26a06be x64
- OS Version: Linux version 4.15.0-32-generic Ubuntu
Steps to Reproduce:
I provided a small example of the issue (see screenshot below).
- Create a function with two overloads
- Try to invoke this function
- Once you typed in the first parameter, the IDE recognizes that it matches the first overload's signature.
However, the auto-completion suggest the literals for both overloads.
I expect the auto-completion to show "BW" and "BY" only!

Does this issue occur when all extensions are disabled?: Yes
The code:
export class MomentHolidayFactory {
public a(input: Germany, second: GermanState): string;
public a(input: Austria, second: AustrianState): string;
public a(input: Country, second: State): string {
return "test";
}
public holidays() {
this.a("de", ""
}
}
type Country = Germany & Austria;
type Germany = "de" | "De" | "DE" | "germany";
type Austria = "Au" | "au" | "AU" | "austria";
type State = GermanState & AustrianState;
type GermanState = "BW" | "BY";
type AustrianState = "Stmk" | "Vbg";
Copied from original issue: Microsoft/vscode#57509
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem TypeScript-Overload-Beispiel im Issue und reproduziere das Vervollständigungsverhalten nach der Eingabe des ersten Arguments. Verfolge den Completion-Einstiegspunkt des Language Service für überladene Funktionen; abgeschlossen ist die Aufgabe, wenn die Vorschläge nach "de" nur "BW" und "BY" und nicht Literale aus beiden Overloads enthalten und ein Regressionstest im relevanten Testbereich hinzugefügt wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100