-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
Prettier 1.11.1
Playground link
Input:
/** @type {Object} */(myObject.property).someProp = true;
(/** @type {Object} */(myObject.property)).someProp = true;
const prop = /** @type {Object} */(myObject.property).someProp;Output:
/** @type {Object} */ myObject.property.someProp = true;
/** @type {Object} */ (myObject.property).someProp = true;
const prop = /** @type {Object} */ (myObject.property.someProp);Second Output:
/** @type {Object} */ myObject.property.someProp = true;
/** @type {Object} */ myObject.property.someProp = true;
const prop = /** @type {Object} */ (myObject.property.someProp);Expected behavior:
The parentheses should be kept as per #2484
Also I would expect the prettier output not to be different for consecutive parsings. Now the second line of the input above gets rewritten to the first one and eventually without parentheses at all.
In the last case of the output above, the parentheses are maintained, but the closing one is moved to the back.
Metadata
Metadata
Assignees
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.