DecorateThis icon indicating copy to clipboard operation
DecorateThis copied to clipboard

Decorator for type-checking 'rest parameters'

Open callumlocke opened this issue 9 years ago • 1 comments

Example taken from MDN:

function multiply(multiplier, ...theArgs) {
  return theArgs.map(function (element) {
    return multiplier * element;
  });
}

Currently there's no way to typecheck all of theArgs.

Maybe there could be a new rest decorator?

@param(Number)
@rest(Number)
@returns(Array)
function multiply(multiplier, ...theArgs) {
  return theArgs.map(function (element) {
    return multiplier * element;
  });
}

callumlocke avatar Jun 08 '15 13:06 callumlocke

Already underway ;)

mako-taco avatar Jun 08 '15 17:06 mako-taco