Skip to content

[Bug]: createParenthesizedExpressions and parens around object rest #14504

@thorn0

Description

@thorn0

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

({ ...(z) } = {});

Configuration file name

No response

Configuration

const { parse } = require("@babel/parser");

const input = `({ ...(z) } = {});`;

const result = parse(input, { createParenthesizedExpressions: true });

console.dir(result, { depth: null });

I didn't find a way to set createParenthesizedExpressions in Babel's REPL, however this issue manifests itself in Prettier (playground).

Current and expected behavior

Current: SyntaxError: Invalid rest operator's argument.
Expected: no error

Environment

this doesn't depend on the environment

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions