microsoft / microsoft/TypeScript
`forEachChild` is hard to use with async API
@andrewbranch がすでに取り組んでいます。
2026年9月1日 から。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
If you try to use the async API, it's a challenge today. The API provides a synchronous tree traversal function (forEachChild), but pulling on semantic information is asynchronous.
The problem isn't the mixture itself - it's that forEachChild stops walking when the visitor function returns a truthy result. This makes it impractical to use with async APIs because every async function returns a Promise which is truthy.
The current workarounds are a little awkward, basically introducing a layer of indirection between the traversal function and forEachChild that uses intermediate queues.
I'm not sure if there's an ideal solution - there's at least two problems right now:
- it feels like we could benefit from a
forEachChildAsyncor something like that. - using
forEachChildis a foot-gun if you've decided to use the async API.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。