-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDeprecated - use "Working as Intended" or "Design Limitation" insteadRevisitAn issue worth coming back toAn issue worth coming back to
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.
Metadata
Metadata
Assignees
Labels
By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDeprecated - use "Working as Intended" or "Design Limitation" insteadRevisitAn issue worth coming back toAn issue worth coming back to