197 lines
4.6 KiB
Plaintext
197 lines
4.6 KiB
Plaintext
|
=== tests/cases/conformance/expressions/functionCalls/callWithSpreadES6.ts ===
|
||
|
|
||
|
interface X {
|
||
|
>X : X
|
||
|
|
||
|
foo(x: number, y: number, ...z: string[]);
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>x : number
|
||
|
>y : number
|
||
|
>z : string[]
|
||
|
}
|
||
|
|
||
|
function foo(x: number, y: number, ...z: string[]) {
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>x : number
|
||
|
>y : number
|
||
|
>z : string[]
|
||
|
}
|
||
|
|
||
|
var a: string[];
|
||
|
>a : string[]
|
||
|
|
||
|
var z: number[];
|
||
|
>z : number[]
|
||
|
|
||
|
var obj: X;
|
||
|
>obj : X
|
||
|
>X : X
|
||
|
|
||
|
var xa: X[];
|
||
|
>xa : X[]
|
||
|
>X : X
|
||
|
|
||
|
foo(1, 2, "abc");
|
||
|
>foo(1, 2, "abc") : void
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
|
||
|
foo(1, 2, ...a);
|
||
|
>foo(1, 2, ...a) : void
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>a : string[]
|
||
|
|
||
|
foo(1, 2, ...a, "abc");
|
||
|
>foo(1, 2, ...a, "abc") : void
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>a : string[]
|
||
|
|
||
|
obj.foo(1, 2, "abc");
|
||
|
>obj.foo(1, 2, "abc") : any
|
||
|
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj : X
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
|
||
|
obj.foo(1, 2, ...a);
|
||
|
>obj.foo(1, 2, ...a) : any
|
||
|
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj : X
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>a : string[]
|
||
|
|
||
|
obj.foo(1, 2, ...a, "abc");
|
||
|
>obj.foo(1, 2, ...a, "abc") : any
|
||
|
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj : X
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>a : string[]
|
||
|
|
||
|
(obj.foo)(1, 2, "abc");
|
||
|
>(obj.foo)(1, 2, "abc") : any
|
||
|
>(obj.foo) : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj : X
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
|
||
|
(obj.foo)(1, 2, ...a);
|
||
|
>(obj.foo)(1, 2, ...a) : any
|
||
|
>(obj.foo) : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj : X
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>a : string[]
|
||
|
|
||
|
(obj.foo)(1, 2, ...a, "abc");
|
||
|
>(obj.foo)(1, 2, ...a, "abc") : any
|
||
|
>(obj.foo) : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>obj : X
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>a : string[]
|
||
|
|
||
|
xa[1].foo(1, 2, "abc");
|
||
|
>xa[1].foo(1, 2, "abc") : any
|
||
|
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>xa[1] : X
|
||
|
>xa : X[]
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
|
||
|
xa[1].foo(1, 2, ...a);
|
||
|
>xa[1].foo(1, 2, ...a) : any
|
||
|
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>xa[1] : X
|
||
|
>xa : X[]
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>a : string[]
|
||
|
|
||
|
xa[1].foo(1, 2, ...a, "abc");
|
||
|
>xa[1].foo(1, 2, ...a, "abc") : any
|
||
|
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>xa[1] : X
|
||
|
>xa : X[]
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>a : string[]
|
||
|
|
||
|
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
||
|
>(<Function>xa[1].foo)(...[1, 2, "abc"]) : any
|
||
|
>(<Function>xa[1].foo) : Function
|
||
|
><Function>xa[1].foo : Function
|
||
|
>Function : Function
|
||
|
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>xa[1] : X
|
||
|
>xa : X[]
|
||
|
>foo : (x: number, y: number, ...z: string[]) => any
|
||
|
>[1, 2, "abc"] : (string | number)[]
|
||
|
|
||
|
class C {
|
||
|
>C : C
|
||
|
|
||
|
constructor(x: number, y: number, ...z: string[]) {
|
||
|
>x : number
|
||
|
>y : number
|
||
|
>z : string[]
|
||
|
|
||
|
this.foo(x, y);
|
||
|
>this.foo(x, y) : void
|
||
|
>this.foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>this : C
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>x : number
|
||
|
>y : number
|
||
|
|
||
|
this.foo(x, y, ...z);
|
||
|
>this.foo(x, y, ...z) : void
|
||
|
>this.foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>this : C
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>x : number
|
||
|
>y : number
|
||
|
>z : string[]
|
||
|
}
|
||
|
foo(x: number, y: number, ...z: string[]) {
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>x : number
|
||
|
>y : number
|
||
|
>z : string[]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class D extends C {
|
||
|
>D : D
|
||
|
>C : C
|
||
|
|
||
|
constructor() {
|
||
|
super(1, 2);
|
||
|
>super(1, 2) : void
|
||
|
>super : typeof C
|
||
|
|
||
|
super(1, 2, ...a);
|
||
|
>super(1, 2, ...a) : void
|
||
|
>super : typeof C
|
||
|
>a : string[]
|
||
|
}
|
||
|
foo() {
|
||
|
>foo : () => void
|
||
|
|
||
|
super.foo(1, 2);
|
||
|
>super.foo(1, 2) : void
|
||
|
>super.foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>super : C
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
|
||
|
super.foo(1, 2, ...a);
|
||
|
>super.foo(1, 2, ...a) : void
|
||
|
>super.foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>super : C
|
||
|
>foo : (x: number, y: number, ...z: string[]) => void
|
||
|
>a : string[]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Only supported in when target is ES6
|
||
|
var c = new C(1, 2, ...a);
|
||
|
>c : C
|
||
|
>new C(1, 2, ...a) : C
|
||
|
>C : typeof C
|
||
|
>a : string[]
|
||
|
|