DecorateThis
DecorateThis copied to clipboard
Decorator for type-checking 'rest parameters'
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;
});
}
Already underway ;)