Skip to content

Parentheses missing with await and typescript parser #16288

@edemaine

Description

@edemaine

Prettier 3.2.5
Playground link

--parser typescript

Input:

(await (await fetch()).json()).foo

Output:

await(await fetch()).json().foo;

Expected output:

(await (await fetch()).json()).foo

Why?

The parentheses are necessary to await the .json() response.

For comparison, it works fine with the babel parser. (Is the typescript parser deprecated? I don't think so.)

I found a very old similar bug. Also an active area of discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.scope:externalThis is not an issue with Prettier, it’s an issue with external software, like an editor integration

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions