microsoft / microsoft/TypeScript
Inconsistent error messages with circular base type argument
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
I noticed here that a type argument to a base class can reference property types in the same class, so I wondered what would happen if I tried to reference an inherited property type that itself depends on the type argument. To its credit, the compiler didn't crash, but the errors I got didn't make much sense.
TypeScript Version: master (e1a4c2779f93c8389d1589e543920a61771e97ec)
Search Terms: circular self referential base extends type argument property same class lookup type
Code
class Super<T> {
foo!: T;
}
class Sub extends Super<Sub["bar"]> {
bar!: Sub["foo"]; // Actual: Error: "Property 'foo' does not exist on type 'Sub'."
baz!: Sub["foo"]; // Actual: No error
}
Expected behavior: An error that indicates that circular type annotations are involved.
Actual behavior: As marked.
Playground Link: link
Related Issues: None found, but this is hard to search for.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
報告に示されている TypeScript の master リビジョンを使用して、提供された Playground Link から不一致を再現し、その後、循環する基底型引数に対するコンパイラーの動作を追跡します。bar と baz のケースが、現在の一致しない結果ではなく、循環する型注釈が関与していることを示す一貫した診断を受け取れば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100