microsoft / microsoft/TypeScript
Generated d.ts imports package that is not installed on current project
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
"d.ts unresolved modules import"
🕗 Version & Regression Information
Typescript v5.5.4
⏯ Playground Link
No response
💻 Code
Here is a basic reproduction: https://github.com/baptisteArno/zod-d-ts-issue
- pnpm install
- pnpm turbo build --filter=package-three...
- See error because schema is of type any
🙁 Actual behavior
package-two generates with imports from zod which package is not installed in package-two.
This means that the type that we get when importing things from package-two are of inferred type any
🙂 Expected behavior
I would expect the d.ts file to instead imports from installed packages only.
In that very specific case, I would expect it to generate:
export declare const schema: typeof import("package-one").schema
instead of
export declare const schema: import("zod").ZodObject<
{
id: import("zod").ZodString;
name: import("zod").ZodString;
},
"strip",
import("zod").ZodTypeAny,
{
id: string;
name: string;
},
{
id: string;
name: string;
}
>;
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
github.com/baptisteArno/zod-d-ts-issue で再現することから始め、pnpm install と pnpm turbo build --filter=package-three... を実行し、package-two の生成された宣言を調べます。推論された宣言型に対してコンパイラーがどのようにインポートを選択するかを追跡します。宣言が利用できない zod パッケージを必要としなくなり、期待される package-one への参照を保持すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100