microsoft / microsoft/TypeScript

Files outside rootDir emit files adjacent to themselves if they are imported by an included file

Offen
#52,889 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Bug Report

The documentation for rootDir states that

Note that TypeScript will never write an output file to a directory outside of outDir, and will never skip emitting a file. For this reason, rootDir also enforces that all files which need to be emitted are underneath the rootDir path.

If any included file imports a ts file outside of rootDir, a declaration file is generated for that imported file and emitted adjacent to it. noEmitOnError needs to be either omitted or set to false, or the -b flag needs to be specified for this to occur.

🔎 Search Terms

noEmitOnError, unwanted declaration files, emits outside outDir, emits outside declarationDir

🕗 Version & Regression Information

On all versions matching ^4.2.4 and on the current nightly, nonexhaustive, haven't checked others

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about tsconfig.json behaviour and commandline behaviour
⏯ Playground Link

https://github.com/gtm-nayan/ts-no-emit-wat/
Sorry, couldn't figure out multiple files in the playground or the workbench.

💻 Code
🙁 Actual behavior

Declaration files emitted outside of output directory.

🙂 Expected behavior

No files should be emitted outside of the specified output directory.

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

Beginne damit, das Verhalten im verknüpften Repository zu reproduzieren, wobei du dich auf eine Datei außerhalb von rootDir konzentrierst, die von einer eingebundenen Datei importiert wird, sowie auf die daraus resultierende Deklarationsausgabe. Verfolge anschließend die Behandlung von rootDir, outDir, declarationDir und noEmitOnError durch den TypeScript-Compiler; abgeschlossen ist die Aufgabe, wenn außerhalb des konfigurierten Ausgabeverzeichnisses keine Deklarationsdateien ausgegeben werden.

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

Neue Issues direkt in Ihr Postfach

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