Skip to content

Await Stripping Parentheses w/ Optional Chaining  #5857

@ericf89

Description

@ericf89

Prettier 1.16.4
Playground link

--parser babylon

Input:

async function HelloWorld() {
  var x = (await foo.bar.blah)?.hi;
}

Output:

async function HelloWorld() {
  var x = await foo.bar.blah?.hi;
}

Expected behavior:

async function HelloWorld() {
  var x = (await foo.bar.blah)?.hi;
}

This seems to be similar to #239 . Things work correctly with normal property access instead of ?.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions