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[/-] [+]Unexpected syntax errors of `a < (b >= c ...)` in TS 4.7[/+] on Jun 15, 2022
  2. MartinJohns commented on Jun 15, 2022

    @MartinJohns
    Contributor

    Most likely another side-effect from #47607.

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

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions