Skip to content

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

@gdh1995

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

Metadata

Metadata

Assignees

Labels

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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions