Microsoft/TypeScript

Generic syntax ambiguity is handled incorrectly

Open

#60,874 建立於 2024年12月29日

在 GitHub 查看
 (1 留言) (1 反應) (0 負責人)TypeScript (6,726 fork)batch import
BugDomain: ParserHelp Wanted

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

🔎 Search Terms

generic syntax ambiguity

🕗 Version & Regression Information

  • I was unable to test this on prior versions because there is no online tooling for it

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAhjAvDAjAGhgIyTATB4HAZgwBMcAWDAUxwFYBuAKFEhABtqA6dkAcwAUCADxYMAwgD4YA8gDIY1AJQrmQA

💻 Code

const a = 1, b = 2, c = 3, d = 4, e = 5;
console.log(a < b, (c > (d & e)));

🙁 Actual behavior

This expression is not callable.

🙂 Expected behavior

true false

Additional information about the issue

While there might be some justification for why

const a = 1, b = 2, c = 3, d = 4, e = 5;
console.log(a < b, c > (d & e));

doesn't work as it did in JS, in the provided example there isn't even any disambiguity.

貢獻者指南