TypeScript
TypeScript copied to clipboard
Destructuring the arguments variable
Doesn't work because the IArguments interface isn't defined as an Array type. Is there a reason behind this?
Example:
function test () {
var [a] = arguments; // Error: Type 'IArguments' is not an array type.
}
One solution is doing this:
function (...args) {
var [ one, two, three ] = args;
}
@tylergoodman no problem - if you'd be willing to open up a separate issue as a suggestion, we could discuss the possibility among the team.
@tylergoodman If you open an issue for this, please mention the issue number here.
#3389