microsoft / microsoft/TypeScript
Declaration file generation not working as expected
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
TypeScript Version: 4.0.0-dev.20200429 (when trying with @next)
TypeScript Version: 3.8.0.0-dev.20200429 (when using my version ^3.8.0)
Search Terms: module resolution, lerna, monorepo, import type, declaration file
Code
Repository https://github.com/Volox/tsc-declaration-issue
To bootstrap and run:
npx lerna bootstrap
npx lerna run compile
Expected behavior: The declaration files generated are only related to the package.
Actual behavior: The declaration files are generated correctly only for lib1 and lib2 have the full tree of declaration files of both packages.

Related Issues: None that I was able to find
Notes:
The generation of declaration files is done correctly if I remove the "paths" property from tsconfig.base.json but I receive compilation errors like:
src/index.ts(1,19): error TS2307: Cannot find module 'lib1'.
src/index.ts(3,24): error TS2307: Cannot find module 'lib1/foo/bar'.
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
Verwende das verlinkte Repository Volox/tsc-declaration-issue und führe zuerst npx lerna bootstrap und anschließend npx lerna run compile aus. Vergleiche die generierten Deklarationen für lib1 und lib2 mit und ohne die Eigenschaft paths in tsconfig.base.json, während du die gemeldeten Fehler bei der Modulauflösung prüfst. Die Aufgabe ist erledigt, wenn jedes Paket nur seinen eigenen Deklarationsbaum ohne diese Fehler ausgibt.
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