Skip to content

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

Closed

Description

@gdh1995

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 <.

Activity

  1. changed the title [-]Syntax error of `a < (b >= c ...)` in TS 4.7.3[/-] on Jun 15, 2022
  2. MartinJohns commented on Jun 15, 2022

    @MartinJohns
    Contributor

    Most likely another side-effect from #47607.

  3. added
    Fix Available
    on Jun 15, 2022
  4. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugFix Available

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions