Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parentheses missing with await and typescript parser #16288

Open
edemaine opened this issue May 14, 2024 · 1 comment
Open

Parentheses missing with await and typescript parser #16288

edemaine opened this issue May 14, 2024 · 1 comment
Labels
lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) scope:external This is not an issue with Prettier, it’s an issue with external software, like an editor integration type:bug Issues identifying ugly output, or a defect in the program

Comments

@edemaine
Copy link

edemaine commented May 14, 2024

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.

@fisker fisker added type:bug Issues identifying ugly output, or a defect in the program lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) scope:external This is not an issue with Prettier, it’s an issue with external software, like an editor integration labels May 15, 2024
@fisker
Copy link
Member

fisker commented May 15, 2024

I've asked the typescript-eslint team about source type support, will post updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) scope:external This is not an issue with Prettier, it’s an issue with external software, like an editor integration type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

2 participants