microsoft / microsoft/TypeScript

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

Aperta
#52,889 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Docs
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il comportamento nel repository collegato, concentrandoti su un file al di fuori di rootDir che viene importato da un file incluso e sull'emissione delle dichiarazioni risultante. Quindi traccia la gestione di rootDir, outDir, declarationDir e noEmitOnError da parte del compilatore TypeScript; il lavoro è concluso quando non vengono emessi file di dichiarazione al di fuori della directory di output configurata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.