microsoft / microsoft/TypeScript

tagged/named rest parameter participating in circular reference causes error

オープン
#63,584 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
Bug Domain: check: Type Circularity
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### 🔎 Search Terms

named tuple element rest recursive circularly references union unions

### 🕗 Version & Regression Information

- This is the behavior in every version I tried, and I reviewed the FAQ for entries about *everything and didn't find anything relevant*

### ⏯ Playground Link

https://www.typescriptlang.org/play/?esModuleInterop=false&target=99&jsx=0&noFallthroughCasesInSwitch=false&ts=6.0.0-dev.20260416&noUnusedLocals=true&noUnusedParameters=true&noUncheckedIndexedAccess=true#code/KYDwDg9gTgLgBDAnmYcDiEIBMAiEDGActqgLwBQcVcAPnAM4xQCWAdgOaXV0DaARMz4AaOADpxGbHiIkeAXTlcqvPgBtBItllAAuOKwCuAWwBGwKCPGjJuAsW3y5AbnLlQkWAmSoAQgENbGW0ARjgKaloGJjZOCJUNMXEYP3Z2YCw9f0D7YGDHcgB6AoiSiIA9CsqKpUj+dWE4LV19YzMLRNEs6Ry8hRc3cGh4JBQ4LrsSACYwmrpGFg5ZuH4Eq3Gg4En8uOW1BKaQPUNTc0sklLSMsYDuqccXItKn5+eqqvIgA

### 💻 Code

```ts
export type GoodDocNode =
| string
| ["i", ...GoodDocNode[]]
| ["li", index: number, ...GoodDocNode[]];

export type BadDocNode1 =
| string
| ["i", ...tagged: BadDocNode1[]]
// ^^^^^^^^
| ["li", index: number, ...BadDocNode1[]];

export type BadDocNode2 =
| string
| ["i", ...BadDocNode2[]]
| ["li", index: number, ...tagged: BadDocNode2[]];
// ^^^^^^^^
```

### 🙁 Actual behavior

Error:
```
Type alias 'BadDocNode1' circularly references itself.
Type alias 'BadDocNode2' circularly references itself.
```

### 🙂 Expected behavior

No errors, because the only differences between the two is the name on the rest parameter in the tuple, nothing structurally is different.

### Additional information about the issue

_No response_

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

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

調査の方向性

リンクされた TypeScript Playground と BadDocNode1/BadDocNode2 の再現例を出発点として使用し、名前付きタプル rest パラメーターの循環型エイリアスチェックを調査してください。再現例で循環参照エラーが発生せず、構造的に同等な GoodDocNode の例が引き続き有効であれば完了です。

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

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
48/100

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

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