microsoft / microsoft/TypeScript

rootDir option documentation incorrect and confusing

Offen
#22,039 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Docs
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

I've recently started a new project with TS and run into some confusing behaviour. I've placed my files in an "app" folder, but the emitted TS (using AMD modules with --outFile) generates module names without the app prefix, breaking my JS references.

Turns out that I was supposed to use rootDir, instead of rootDirs.

The first issue is that since #5819, this actually does affect outFile as well, so the documentation clearly stating it only applies to outDir is wrong.
The second issue is that it's really confusing the difference between rootDirs and rootDir, and it's still unclear to me why rootDirs: ["./"] did not produce the same result as rootDir: "./". The written documentation is not very clear out this and potentially, one or both options neeed renaming.

This is referencing the current live version on https://www.typescriptlang.org/docs/handbook/compiler-options.html

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der im Issue verlinkten Handbuchseite zu den Compiler-Optionen und vergleichen Sie die Beschreibungen von rootDir, rootDirs und outFile. Stellen Sie klar, dass rootDir outFile ebenso wie outDir beeinflusst, erklären Sie, warum rootDirs: ["./"] sich von rootDir: "./" unterscheidet, und aktualisieren Sie die Dokumentation, sodass der Unterschied verständlich ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers, documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.