2015-02-03 00:15:54 +01:00
|
|
|
//// [restParametersOfNonArrayTypes.ts]
|
|
|
|
// Rest parameters must be an array type if they have a type annotation, so all these are errors
|
|
|
|
|
|
|
|
function foo(...x: string) { }
|
|
|
|
var f = function foo(...x: number) { }
|
|
|
|
var f2 = (...x: Date, ...y: boolean) => { }
|
|
|
|
|
|
|
|
class C {
|
|
|
|
foo(...x: C) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
interface I {
|
|
|
|
(...x: string);
|
|
|
|
foo(...x: number, ...y: number);
|
|
|
|
}
|
|
|
|
|
|
|
|
var a: {
|
|
|
|
(...x: string);
|
|
|
|
foo(...x: string);
|
|
|
|
}
|
|
|
|
|
|
|
|
var b = {
|
|
|
|
foo(...x: string) { },
|
|
|
|
a: function foo(...x: number, ...y: Date) { },
|
|
|
|
b: (...x: string) => { }
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [restParametersOfNonArrayTypes.js]
|
|
|
|
// Rest parameters must be an array type if they have a type annotation, so all these are errors
|
2015-02-07 03:45:09 +01:00
|
|
|
function foo() { }
|
|
|
|
var f = function foo() { };
|
|
|
|
var f2 = function (x) { };
|
2015-02-03 00:15:54 +01:00
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
2015-02-07 03:45:09 +01:00
|
|
|
C.prototype.foo = function () { };
|
2015-02-03 00:15:54 +01:00
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var a;
|
|
|
|
var b = {
|
2015-02-07 03:45:09 +01:00
|
|
|
foo: function () { },
|
|
|
|
a: function foo(x) { },
|
|
|
|
b: function () { }
|
2015-02-03 00:15:54 +01:00
|
|
|
};
|