Parser misinterprets async() calls in conditional expressions as async arrow functions
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
- 領域
- compilers
調査の方向性
まず、TypeScript パーサーで 2 つの条件式の例を再現し、async() が async アロー関数と比較してどのように分類されるかを確認してください。関連するパース動作の参考として、リンク先の Oxc の修正を使用してください。完了条件は、報告された診断なしに両方の例を正常にパースでき、示されたケースに対するリグレッションカバレッジがあることです。
索引モデルが issue の本文から書いたものです。
説明
🔎 Search Terms
parser, async, conditional
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
No response
💻 Code
const a = true;
const b = 1;
function async(): number {
return b;
}
const first = a ? async() : 0;
// TS1005: '=>' expected.
const second = a ? async() : x => x;
// TS1005: ':' expected.
🙁 Actual behavior
The parser appears to interpret async() as the beginning of an async arrow function and the conditional separator as a return-type annotation.
The first case also produces a syntax diagnostic when parsed as JavaScript after removing the : number annotation. Node accepts and executes that JavaScript equivalent
🙂 Expected behavior
Both conditional expressions should parse successfully. async() is a call to the function named async, and the following colon separates the conditional’s branches.
Additional information about the issue
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
microsoft/TypeScript#64322 · コメント 2 件 · リアクション 1 件 · 担当者 2 名 ·
-
Possible Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/TypeScript#64278 · コメント 1 件 · リアクション 1 件 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
microsoft/TypeScript#64118 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
microsoft/TypeScript#64094 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/TypeScript#63959 · コメント 5 件 ·
microsoft/TypeScript の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
milvus-io/birdwatcher#545 ·
-
kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
kubernetes-sigs/prow#953 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
caddyserver/caddy#8046 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
jaegertracing/jaeger#9588 ·