microsoft / microsoft/TypeScript

Declaration file generation not working as expected

オープン
#38,250 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

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.
Screenshot 2020-04-29 at 15 43 25

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'.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされている Volox/tsc-declaration-issue リポジトリを使用し、npx lerna bootstrap に続けて npx lerna run compile を実行します。tsconfig.base.jsonpaths プロパティがある場合とない場合について、lib1lib2 で生成される declaration を比較し、報告されているモジュール解決エラーも確認します。各パッケージがこれらのエラーなしに自身の declaration ツリーだけを出力すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。