-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue
Description
Example from ES6
[1, 2, ...items, 3, ...moreItems]
Type checking
The type of the array is the best common type of the individual elements and the element types of each of the "spread" elements.
Codegen
[1, 2, ...items, 3, ...moreItems]
becomes:
[1,2].concat(items, [3], moreItems)
If the array starts with a spread, you can concat off the spread:
[...items, 1, 2, ...moreItems]
becomes:
items.concat([1, 2], moreItems)
Questions
What if it's 'any'? We don't know, so we have to codegen a slice. One possible issue is that .concat doesn't take array-like, it takes arrays only. This won't be a problem for spread arguments because .apply should take array-likes.
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue