-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: TransformsRelates to the public transform APIRelates to the public transform APIFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: nightly (2.0.0-dev.20160920)
TypeScript Command: tsc --target ES5 test.ts
Code (test.ts)
// This arrow shorthand will be properly transformed
let log = (t) => { console.log(t); };
// The arrow shorthand used in the for-loop won't be properly transformed
let items = [{ name: "A" }, { name: "C" }, { name: "B" }];
for (var item of items.sort((a, b) => a.name.localeCompare(b.name))) {
console.log(item);
}
becomes
var log = function (t) { console.log(t); };
var items = [{ name: "A" }, { name: "C" }, { name: "B" }];
for (var _i = 0, _a = items.sort((a, b) => a.name.localeCompare(b.name)); _i < _a.length; _i++) {
var item = _a[_i];
console.log(item);
}
Expected behavior:
When I target ES5 I don't expect any arrow shorthands to end up in the final JS.
Actual behavior:
You can see that the arrow shorthand after items.sort
is still there.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: TransformsRelates to the public transform APIRelates to the public transform APIFixedA PR has been merged for this issueA PR has been merged for this issue