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

jsdoc comment parenthesis removal breaks return in some case #15013

Closed
700software opened this issue Jul 5, 2023 · 2 comments · Fixed by #15037
Closed

jsdoc comment parenthesis removal breaks return in some case #15013

700software opened this issue Jul 5, 2023 · 2 comments · Fixed by #15037
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@kachkaev kachkaev added type:bug Issues identifying ugly output, or a defect in the program lang:javascript Issues affecting JS labels Jul 5, 2023
@gusbmurphy
Copy link

Would the following be the expected output?

function test() {
  return (
    /**
     * @type {...}
     */
    (expression)
  )
}

Seems tricky given that Prettier (I'm assuming) wants to do away with one set of the parentheses.

@700software
Copy link
Author

700software commented Jul 8, 2023

#15037 fixes this beautifully from my testing

Playground

Input Output (It works now!)
function testWithJsdocTypeCastSingleLine() {
  return ((
    /** @type {...} */(
      (expresssion)
    )
  ))
}

function testWithJsdocTypeCastMultiLine() {
  return ((
    /**
     * @type {...}
     */((expresssion))
  ))
}

function testWithAnyOtherCommentSingleLine() {
  return ((
    /** type {...} */(
      (expresssion)
    )
  ))
}

function testWithAnyOtherCommentMultiLine() {
  return ((
    /**
     * type {...}
     */((expresssion))
  ))
}
function testWithJsdocTypeCastSingleLine() {
  return /** @type {...} */ (expresssion);
}

function testWithJsdocTypeCastMultiLine() {
  return (
    /**
     * @type {...}
     */ (expresssion)
  );
}

function testWithAnyOtherCommentSingleLine() {
  return /** type {...} */ expresssion;
}

function testWithAnyOtherCommentMultiLine() {
  return (
    /**
     * type {...}
     */ expresssion
  );
}

@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants