microsoft / microsoft/TypeScript
Including full error range in TSC output
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
From https://github.com/Microsoft/vscode/issues/70465
Repo
-
For the TS code with
strictenabled:const obj = { prop: Date.now() ? 'str' : undefined } obj.prop.toLowerCase(); -
Run a tsc task in VS Code to see reported errors (make sure to close the ts file as well)
Problem
We currently only report the potential undefined access error on obj in the line obj.prop.toLowerCase();. The correct range should span obj.prop.
The root cause of this is that VS Code's problem matcher does not have the full range of the error from tsc, only the start line and column. Here's the tsc output:
src/index.ts:7:1 - error TS2532: Object is possibly 'undefined'.
7 obj.prop.toLowerCase();
~~~~~~~~
With the current tsc output, there is also no way to extract the full range of the error.
Request
Somewhere in the line src/index.ts:7:1 - error TS2532: Object is possibly 'undefined'.
, add the end position as well so that tooling can properly highlight it. We would want to do this in a way that doesn't detract from the error's human readability. This needs some thought
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
Reproduziere das Problem mit dem bereitgestellten strikten TypeScript-Beispiel und untersuche die tsc-Diagnoseausgabe auf TS2532. Ermittle, wie die Endposition der Diagnose einbezogen werden kann, ohne die Lesbarkeit für Menschen zu beeinträchtigen; abgeschlossen ist die Aufgabe, wenn Tools den vollständigen Bereich extrahieren können und der bestehende Fehler verständlich bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100