microsoft / microsoft/TypeScript
A[] form works, but Array<A> breaks
オープン
まだ誰も着手していません。
Bug
Domain: check: Type Circularity
Effort: Moderate
Help Wanted
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Bug Report
🔎 Search Terms
site:github.com inurl:/microsoft/TypeScript/issues/ Array [] normalization syntactic sugar
🕗 Version & Regression Information
This works in 3.9.7, broke in 4.0.5, and remains broken in Nightly.
- This changed between versions 3.9.7 and 4.0.5
⏯ Playground Link
Playground link with relevant code
💻 Code
type R<C> = [C, ...R<C>[]] | number; // works, as expected
type S<C> = [C, ...Array<S<C>>] | number; // fails unexpectedly - should work identically
const r: R<"add"> = ["add", 2, 1];
const s: S<"add"> = ["add", 2, 1];
🙁 Actual behavior
The A[] form in the first line works, but the otherwise-identical Array<…> form on the second line breaks with the warning Type alias 'S' circularly references itself.(2456).
🙂 Expected behavior
Both of these should work, and behave identically, as they are merely syntactic sugar for each other.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされたPlaygroundの例と最小限のRおよびS型エイリアスから始め、TypeScript 3.9.7、4.0.5、Nightlyの間で挙動を比較します。循環型エイリアスのチェックと、Array と T[] の扱いを追跡します。両方の等価な再帰エイリアスが循環参照の診断なしにコンパイルできれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100