facebook / facebook/flow

Recursive generics

オープン
#4,955 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Rust
スター
22.3k
フォーク
1.9k
PR マージ指標
30日以内にマージされた PR はありません

説明

Not sure if it's a bug or a feature request, since neither way of defining a recursive generic type is in the documentation, afaik.

[A generic's qualification cannot reference itself:
](https://flow.org/try/#0GYVwdgxgLglg9mABMOcA8AVAXIg3gIwEMAnAfhwwF8A+ACgEpdKg
)
```
1: function foo(){}
^ identifier `T`. Could not resolve name
```

[But a type definition can:
](https://flow.org/try/#0C4TwDgpgBAcg9gEwgHgCoD4oF4oG8BQUUARgIYBOAXLIihvgL74BmArgHYDGwAlnO1GZw4yAOroAFO1rV4SMegCUuBkA)
```flow
type Node = {
bar: Node
}
function foo(node: Node){}
```
Judging by the fact the latter is implemented, it shouldn't be hard to add.

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

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

評価

この issue はまだ評価されていません。

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

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