Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rest in arrays is not fully supported in Safari <= 13 #17773

@magic-akari

Description

@magic-akari

💻

  • 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)); // true

Configuration 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions