Closed
Description
TypeScript Version:
1.8.2
Code
function whatever (idA, idB) {
[idA, idB] = [idB, idA];
return true;
}
Expected behavior:
function whatever(idA, idB) {
var _a;
_a = [idB, idA], idA = _a[0], idB = _a[1];
return true;
}
Actual behavior:
function whatever(idA, idB) {
_a = [idB, idA], idA = _a[0], idB = _a[1];
return true;
var _a;
}
Thanks to variable hoisting, there is no functional problem here. However, I consider the compiled code unintuitive.
In addition, using Istanbul for code coverage highlights the var _a;
declaration as not covered.