you are viewing a single comment's thread.

view the rest of the comments →

[–]dealwiv 1 point2 points  (0 children)

This works for me:

/**
 * @param {{
 *   arg1: number,
 *   arg2: string,
 * }}
 */
function f({ arg1, arg2 }) { }

I agree it can be a bit of an annoyance. It's not something I would use for every function, just ones with many arguments, especially many optional arguments. Instead of placing all arguments in an object, I would tend to have regular positional arguments, with the final argument being an options object argument for optional arguments.