futurGH / ts-to-jsdoc

Transpile TypeScript code to fully compatible JavaScript + JSDoc comments.
MIT License
181 stars 17 forks source link

Prefer last JSDoc comment #25

Closed jackcannon closed 1 year ago

jackcannon commented 1 year ago

In the case of multiple JSDoc comment before the function, prefer the last (and therefore the closest to the function)

Input

/**
 * A random orphan JSDoc comment.
 */
/**
 * Does stuff.
 */
function doStuff(param: string): number {
  return 1;
};

❌ Before

/**
 * A random orphan JSDoc comment.
 * @param {string} param
 * @returns {number}
 */
/**
 * Does stuff.
 */
function doStuff(param) {
    return 1;
}
;

✅ After

/**
 * A random orphan JSDoc comment.
 */
/**
 * Does stuff.
 * @param {string} param
 * @returns {number}
 */
function doStuff(param) {
    return 1;
}
;