futurGH/ts-to-jsdoc

param is too verbose. should use only simple param names

Closed this issue · 0 comments

input

function f({
  a,
  b,
}: {
  a: string,
  b: number,
}, arg2: string) {
  return a + arg2
}

actual

/**
 * @param {{
 *   a: string,
 *   b: number,
 * }} {
 *   a,
 *   b,
 * }
 * @param {string} arg2
 * @returns {string}
 */
function f({ a, b, }, arg2) {
    return a + arg2;
}

expected: remove the { a, b }

/**
 * @param {{
 *   a: string,
 *   b: number,
 * }}
 * @param {string} arg2
 * @returns {string}
 */
function f({ a, b, }, arg2) {
    return a + arg2;
}

javascript has only positional arguments (compared to python's kwargs)
so it's safe to skip the variable name if its too complex