Closed
Description
TypeScript Version:
1.8.7
Code
let firstValue = 1;
let secondValue = 2;
[firstValue, secondValue] = [3, 4];
Expected behavior:
var firstValue = 1;
var secondValue = 2;
var _a;
_a = [3, 4], firstValue = _a[0], secondValue = _a[1];
Actual behavior:
var firstValue = 1;
var secondValue = 2;
_a = [3, 4], firstValue = _a[0], secondValue = _a[1];
var _a;
Closure Compiler reports _a
as unreachable code / use before definition. While this works at runtime, it's not a good practice and looks like a bug in tsc.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
mhegazy commentedon Mar 26, 2016
duplicate of #7017
mhegazy commentedon Mar 26, 2016
as explained in #7017 (comment), we intend to change this in the future, just to make the code more idiomatic and less machine-generated-like.