-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Open
Labels
Description
💻
- Would you like to work on a fix?
How are you using Babel?
Other (Next.js, Gatsby, vue-cli, ...)
Input code
const x = [0, void 0];
let [a, ..._rest] = x;
console.log({ a, _rest });
console.log(Array.isArray(_rest)); // trueConfiguration file name
No response
Configuration
env target safari 10-13
Current and expected behavior
The output code remains unchanged, but Safari 10-13 does not fully support rest in array literals, so the result does not match the expected behavior.
In Safari 10-13, the code outputs false, but according to the ES spec, it should output true.
Environment
All Babel versions
Safari 10-13
Possible solution
The transform-destructuring feature in packages/babel-compat-data/data/plugins.json needs to be updated to mark Safari and iOS support as version 14 or higher (since Safari 13 still doesn't fully support it).
Additional context
- This issue was originally identified in the SWC repository at safari(13.1.2) es2016 Bug caused by function parameter compression swc-project/swc#11513
Reactions are currently unavailable