Skip to content

[bug] Ternary + arrow function is not correctly parsed #16241

@nicolo-ribaudo

Description

@nicolo-ribaudo

TypeScript Version: Online repl

Code

var a = b ? (c) : d => e;

https://www.typescriptlang.org/play/index.html#src=var%20a%20%3D%20b%20%3F%20(c)%3A%20d%20%3D%3E%20e%3B

Expected behavior:
It is valid javascript, thus it should be parsed correctly

Actual behavior:
It is parsed as

var consequent = (c) : d => e
var a = b ? consequent

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