-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Currenty the function like this:
const foo = (...args: any[]): void => {
}is transpiled into
var foo = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
};You may notice that zero subtraction in the args[_i-0] part is useless.
My proposal is to drop it and use just args[_i] in cases when the function signature consists only of spread.
This small change won't affect the generated code behavior, but would make it slightly more readable and compact.
You can preview the results here, and here's the proposed change
Metadata
Metadata
Assignees
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript