Skip to content

Broken nestled jsdoc comments for overloaded functions #7724

@grassator

Description

@grassator

Prettier 1.19.1
Playground link

--parser babel

Input:

const foo = "Bar";

/**
 * @template T
 * @param {Type} type
 * @param {T} value
 * @return {Value}
 *//**
 * @param {Type} type
 * @return {Value}
 */
function value(type, value) {
  if (arguments.length === 2) {
    return new ConcreteValue(type, value);
  } else {
    return new Value(type);
  }
}

Output:

const foo = "Bar";
/**
 * @param {Type} type
 * @return {Value}
 */

/**
 * @template T
 * @param {Type} type
 * @param {T} value
 * @return {Value}
 */ function value(type, value) {
  if (arguments.length === 2) {
    return new ConcreteValue(type, value);
  } else {
    return new Value(type);
  }
}

Expected behavior:
Output identical to input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:commentsIssues with how Prettier prints commentslocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions