microsoft / microsoft/TypeScript
TS2589 regression in 6.0: implements without type parameters causes excessive type instantiation when property uses concrete generic type
オープン
まだ誰も着手していません。
Fixed
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
🔎 Search Terms
Type instantiation is excessively deep and possibly infinite.
🕗 Version & Regression Information
- This changed between versions 5.9.3 and 6.0.2
⏯ Playground Link
💻 Code
import type { RouterLocation, WebComponentInterface } from "@vaadin/router";
type RouteExt = { section?: string };
// TS2589 on the class declaration below.
// Fix: replace `WebComponentInterface` with `WebComponentInterface<RouteExt>`.
//
// Note: the error only triggers because `location` is typed with a concrete type
// parameter (`RouterLocation<RouteExt>`). Using `RouterLocation` without a type
// parameter does not trigger it.
export class MyElement extends HTMLElement implements WebComponentInterface {
location?: RouterLocation<RouteExt>;
}
🙁 Actual behavior
I get this error:
Type instantiation is excessively deep and possibly infinite.
But the information isn't very useful to know what to do exactly in this case.
🙂 Expected behavior
Ideally no error, otherwise some more pointers about how to fix this.
Additional information about the issue
When running with --extendedDiagnostics:
typescript 5.9.3:
Files: 259
Types: 203241
Instantiations: 2593860
typescript 6.0.2:
Files: 259
Types: 217322
Instantiations: 5379836
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた Playground から始め、--extendedDiagnostics を使用して TypeScript 5.9.3 と 6.0.2 を比較し、implements 宣言と具体的な RouterLocation プロパティに焦点を当てます。TS2589 の原因となっている型インスタンス化の経路を追跡し、提供された再現例に対して結果を検証します。完了の条件は、例でエラーが報告されなくなるか、より実行可能な指針が示されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100