Skip to content

Unexpected syntax errors of a < (b >= c ...) in TS 4.7 #49551

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
gdh1995 opened this issue Jun 15, 2022 · 1 comment Β· Fixed by #49560
Closed

Unexpected syntax errors of a < (b >= c ...) in TS 4.7 #49551

gdh1995 opened this issue Jun 15, 2022 · 1 comment Β· Fixed by #49560
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@gdh1995
Copy link
Contributor

gdh1995 commented Jun 15, 2022

Bug Report

πŸ”Ž Search Terms

  • Syntax error
  • error TS1005

πŸ•— Version & Regression Information

  • This changed between versions 4.6.3 and 4.7.2

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

"use strict";
const enum MyVer { v1 = 1, v2 = 2 }
let ver = 21
const a = ver < (MyVer.v1 >= MyVer.v2 ? MyVer.v1 : MyVer.v2)

πŸ™ Actual behavior

It reports error TS1005:

R:/working/a.ts:4:27 - error TS1005: ')' expected.

4 const a = ver < (MyVer.v1 >= MyVer.v2 ? MyVer.v1 : MyVer.v2)
                            ~

R:/working/a.ts:4:60 - error TS1005: ',' expected.

4 const a = ver < (MyVer.v1 >= MyVer.v2 ? MyVer.v1 : MyVer.v2)
                                                             ~


Found 2 errors in the same file, starting at: R:/working/a.ts:4

πŸ™‚ Expected behavior

The part between ( and ) should be parsed as an operand of <.

@gdh1995 gdh1995 changed the title Syntax error of a < (b >= c ...) in TS 4.7.3 Unexpected syntax errors of a < (b >= c ...) in TS 4.7 Jun 15, 2022
@MartinJohns
Copy link
Contributor

Most likely another side-effect from #47607.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants