microsoft / microsoft/TypeScript
Don't include full paths in module names in error messages
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
TypeScript Version: 4.0.5 (also tested with typescript@next)
Search Terms: namespace has no exported member error
Description
Currently certain error messages shows full file paths. For example:
Namespace '"y:/projects/opf/portal/OPF.Portal.Web/Content/Scripts/DinSide/App/Store/index"' has no exported member 'All'. ts(2694)
Could not find a declaration file for module 'shortid'. 'y:/projects/opf/portal/OPF.Portal.Web/node_modules/shortid/index.js' implicitly has an 'any' type.
Trynpm install @types/shortidif it exists or add a new declaration (.d.ts) file containingdeclare module 'shortid';ts(7016)
Our project was started without strict: true (and few @typescript-eslint rules), so the code base includes several thousand errors. To be able to gradually fix them, we have started to use betterer, which includes committing a snapshot of all the current errors. Snapshot is then used to report report when we fix errors, and fail our build if we add new errors. But because of certain Typescript errors using full file paths, we're getting unnecessary diffs in this snapshot.
Would it be possible to use file paths relative to the project/tsconfig.json root in the error messages instead?
So, with tsconfig.json in y:/projects/opf/portal/OPF.Portal.Web/, the error message would instead be:
Namespace '"Content/Scripts/DinSide/App/Store/index"' has no exported member 'All'. ts(2694)
An alternative solution could be to change betterer instead, make it auto-replace file paths with relative paths, or something like that. But figured I could at least ask here, especially since it could maybe be an issue for other tools as well.
Related Issues: Couldn't find any
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 die Diagnosecodes 2694 und 7016 anhand der Beispiele und eines tsconfig.json-Roots und verfolge dann, wo Modulnamen und Pfade zu Deklarationsdateien formatiert werden. Als abgeschlossen gilt die Aufgabe, wenn diese Meldungen Pfade relativ zum Projekt-Root verwenden, ohne bestehende Diagnosen oder den vorgeschlagenen npm-Deklarationstext zu beeinträchtigen.
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