2014-07-13 01:04:16 +02:00
|
|
|
//// [restParamsWithNonRestParams.ts]
|
|
|
|
function foo(...b:number[]){}
|
|
|
|
foo(); // ok
|
|
|
|
function foo2(a:string, ...b:number[]){}
|
|
|
|
foo2(); // should be an error
|
|
|
|
function foo3(a?:string, ...b:number[]){}
|
|
|
|
foo3(); // error but shouldn't be
|
|
|
|
|
|
|
|
//// [restParamsWithNonRestParams.js]
|
|
|
|
function foo() {
|
|
|
|
var b = [];
|
|
|
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
|
|
b[_i - 0] = arguments[_i];
|
|
|
|
}
|
|
|
|
}
|
2014-08-16 00:49:09 +02:00
|
|
|
foo(); // ok
|
2014-07-13 01:04:16 +02:00
|
|
|
function foo2(a) {
|
|
|
|
var b = [];
|
|
|
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
|
|
b[_i - 1] = arguments[_i];
|
|
|
|
}
|
|
|
|
}
|
2014-08-16 00:49:09 +02:00
|
|
|
foo2(); // should be an error
|
2014-07-13 01:04:16 +02:00
|
|
|
function foo3(a) {
|
|
|
|
var b = [];
|
|
|
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
|
|
b[_i - 1] = arguments[_i];
|
|
|
|
}
|
|
|
|
}
|
2014-08-16 00:49:09 +02:00
|
|
|
foo3(); // error but shouldn't be
|