microsoft / microsoft/TypeScript

Treatment of recursive tuples that utilize type spread.

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

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

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

説明

TypeScript Version: 4.0.2

Search Terms: spread tuple in recursive tuple type

Code

I'm trying to model a type that could evaluate to any of the following:

["list", "of", "Post"];
["list", "of", "list", "of", "Post"];
["list", "of", "list", "of", "list", "of", "Post"];
// ... could go on

The following approach produces a circularity error, even though tuple types are circularity-capable since 3.7 :/

type Nested = ["list", "of", ...(["Post"] | Nested)];

Expected behavior:

To be able to type-check the following (for example):

const nested: Nested = ["list", "of", "list", "of", "Post"];

Actual behavior:

Circularity error.

Any help would be greatly appreciated! Thank you!

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

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

はじめの一歩

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

調査の方向性

ソースファイルもテストも指定されていません。まず、提供されている TypeScript 4.0.2 の再帰的タプルの例で循環性エラーを再現し、次に、再帰的タプル型と type spreads の type-checker における処理を追跡してください。サンプル宣言とネストされた値が循環性エラーなしで型チェックされ、適切なコンパイラテスト領域にカバレッジが追加されていれば完了です。

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

評価

技術スタック
typescript
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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