-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Labels
lang: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.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!
Description
Prettier 1.13.7
Playground link
--parser babylonJSDoc @type allows casting types of a reference but it requires a pair parentheses around the target reference. Prettier should not remove it.
Input:
class Chunk {
/**
* @returns {boolean} whether or not the Chunk will have a runtime
*/
hasRuntime() {
for (const chunkGroup of this._groups) {
// We only need to check the first one
return (
chunkGroup.isInitial() &&
/** @type {Entrypoint} */ (chunkGroup).getRuntimeChunk() === this
);
}
return false;
}
}Output:
class Chunk {
/**
* @returns {boolean} whether or not the Chunk will have a runtime
*/
hasRuntime() {
for (const chunkGroup of this._groups) {
// We only need to check the first one
return (
chunkGroup.isInitial() &&
/** @type {Entrypoint} */ (chunkGroup.getRuntimeChunk() === this)
);
}
return false;
}
}Expected behavior:
class Chunk {
/**
* @returns {boolean} whether or not the Chunk will have a runtime
*/
hasRuntime() {
for (const chunkGroup of this._groups) {
// We only need to check the first one
return (
chunkGroup.isInitial() &&
/** @type {Entrypoint} */ (chunkGroup).getRuntimeChunk() === this
);
}
return false;
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lang: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.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!