Skip to content

Not compiling to valid ES3 code and emits no warning #23720

@haochi

Description

@haochi

TypeScript Version: 2.8.0-insiders.20180320

Search Terms: literal, invalid left-hand side assignment, es3

Code

var a = [] = [1].map(_ => _);
var b = [1].map(_ => _);

Expected behavior:
Compiles to valid ES3 code.

var a = [1].map(function (_) { return _; });
var b = [1].map(function (_) { return _; });

Actual behavior:
Doesn't compile to valid ES3 code and emits no warnings.

var a = [1].map(_ => _);
var b = [1].map(function (_) { return _; });

Playground Link: https://www.typescriptlang.org/play/#src=var%20a%20%3D%20%5B%5D%20%3D%20%5B1%5D.map(_%20%3D%3E%20_)%3B%0D%0Avar%20b%20%3D%20%5B1%5D.map(_%20%3D%3E%20_)%3B%0D%0A

Related Issues:
Can't find any.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions