59 lines
No EOL
1.6 KiB
Text
59 lines
No EOL
1.6 KiB
Text
tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
|
|
|
|
|
|
==== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts (1 errors) ====
|
|
interface X {
|
|
foo(x: number, y: number, ...z: string[]);
|
|
}
|
|
|
|
function foo(x: number, y: number, ...z: string[]) {
|
|
}
|
|
|
|
var a: string[];
|
|
var z: number[];
|
|
var obj: X;
|
|
var xa: X[];
|
|
|
|
foo(1, 2, "abc");
|
|
foo(1, 2, ...a);
|
|
foo(1, 2, ...a, "abc");
|
|
|
|
obj.foo(1, 2, "abc");
|
|
obj.foo(1, 2, ...a);
|
|
obj.foo(1, 2, ...a, "abc");
|
|
|
|
(obj.foo)(1, 2, "abc");
|
|
(obj.foo)(1, 2, ...a);
|
|
(obj.foo)(1, 2, ...a, "abc");
|
|
|
|
xa[1].foo(1, 2, "abc");
|
|
xa[1].foo(1, 2, ...a);
|
|
xa[1].foo(1, 2, ...a, "abc");
|
|
|
|
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
|
|
|
class C {
|
|
constructor(x: number, y: number, ...z: string[]) {
|
|
this.foo(x, y);
|
|
this.foo(x, y, ...z);
|
|
}
|
|
foo(x: number, y: number, ...z: string[]) {
|
|
}
|
|
}
|
|
|
|
class D extends C {
|
|
constructor() {
|
|
super(1, 2);
|
|
super(1, 2, ...a);
|
|
}
|
|
foo() {
|
|
super.foo(1, 2);
|
|
super.foo(1, 2, ...a);
|
|
}
|
|
}
|
|
|
|
// Only supported in when target is ES6
|
|
var c = new C(1, 2, ...a);
|
|
~~~~
|
|
!!! error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
|
|
|