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

Add parentheses for TSTypeOperator #14140

Closed
onishi-kohei opened this issue Jan 8, 2023 · 7 comments
Closed

Add parentheses for TSTypeOperator #14140

onishi-kohei opened this issue Jan 8, 2023 · 7 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Comments

@onishi-kohei
Copy link
Contributor

Prettier 2.8.2
Playground link

--parser typescript

Input:

a as (typeof node.children)!

Output:

a as typeof node.children!;

Expected behavior:

a as (typeof node.children)!
@spennine

This comment was marked as off-topic.

@fisker
Copy link
Sponsor Member

fisker commented Jan 9, 2023

@spennine Your issue not related to this one, you must have different version of Prettier installed.

@spennine
Copy link

spennine commented Jan 9, 2023

ty @fisker , we are seeing this using 2.8.2; 2.8.1 didn't exhibit this issue.

@fisker
Copy link
Sponsor Member

fisker commented Jan 9, 2023

Your editor is running old version.

@thorn0
Copy link
Member

thorn0 commented Jan 9, 2023

I never saw code like this (as + !), but if the goal of the parens is to make the precedence of operators more visible, then it makes more sense to place them this way: (a as typeof node.children)!

@onishi-kohei
Copy link
Contributor Author

I ran it and got the following.
Looks good as is.
Input:

(a as typeof node.children)!

Output:

(a as typeof node.children)! ;

@fisker
Copy link
Sponsor Member

fisker commented Jan 14, 2023

This was proposed base on my comment #14042 (comment) I guess.
Let's close this since the code doesn't make sense.

@fisker fisker closed this as completed Jan 14, 2023
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Nov 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

4 participants