65 lines
No EOL
1.9 KiB
Text
65 lines
No EOL
1.9 KiB
Text
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts (6 errors) ====
|
|
// Rest parameters must be an array type if they have a type annotation, errors only for the functions with 2 rest params
|
|
|
|
function foo(...x: number[]) { }
|
|
var f = function foo(...x: number[]) { }
|
|
var f2 = (...x: number[], ...y: number[]) => { }
|
|
~
|
|
!!! A rest parameter must be last in a parameter list.
|
|
|
|
class C {
|
|
foo(...x: number[]) { }
|
|
}
|
|
|
|
interface I {
|
|
(...x: number[]);
|
|
foo(...x: number[], ...y: number[]);
|
|
~
|
|
!!! A rest parameter must be last in a parameter list.
|
|
}
|
|
|
|
var a: {
|
|
(...x: number[]);
|
|
foo(...x: number[]);
|
|
}
|
|
|
|
var b = {
|
|
foo(...x: number[]) { },
|
|
a: function foo(...x: number[], ...y: number[]) { },
|
|
~
|
|
!!! A rest parameter must be last in a parameter list.
|
|
b: (...x: number[]) => { }
|
|
}
|
|
|
|
|
|
|
|
|
|
function foo2(...x: Array<string>) { }
|
|
var f3 = function foo(...x: Array<string>) { }
|
|
var f4 = (...x: Array<string>, ...y: Array<string>) => { }
|
|
~
|
|
!!! A rest parameter must be last in a parameter list.
|
|
|
|
class C2 {
|
|
foo(...x: Array<string>) { }
|
|
}
|
|
|
|
interface I2 {
|
|
(...x: Array<string>);
|
|
foo(...x: Array<string>, ...y: Array<string>);
|
|
~
|
|
!!! A rest parameter must be last in a parameter list.
|
|
}
|
|
|
|
var a2: {
|
|
(...x: Array<string>);
|
|
foo(...x: Array<string>);
|
|
}
|
|
|
|
var b2 = {
|
|
foo(...x: Array<string>) { },
|
|
a: function foo(...x: Array<string>, ...y: Array<string>) { },
|
|
~
|
|
!!! A rest parameter must be last in a parameter list.
|
|
b: (...x: Array<string>) => { }
|
|
} |