Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorator for type-checking 'rest parameters' #13

Open
callumlocke opened this issue Jun 8, 2015 · 1 comment
Open

Decorator for type-checking 'rest parameters' #13

callumlocke opened this issue Jun 8, 2015 · 1 comment

Comments

@callumlocke
Copy link
Contributor

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;
  });
}
@mako-taco
Copy link
Owner

Already underway ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants