62 lines
2.2 KiB
Text
62 lines
2.2 KiB
Text
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures.ts ===
|
|
module CallSignature {
|
|
>CallSignature : typeof CallSignature
|
|
|
|
declare function foo1(cb: (x: number) => void): typeof cb;
|
|
>foo1 : { (cb: (x: number) => void): (x: number) => void; (cb: any): any; }
|
|
>cb : (x: number) => void
|
|
>x : number
|
|
>cb : (x: number) => void
|
|
|
|
declare function foo1(cb: any): any;
|
|
>foo1 : { (cb: (x: number) => void): (x: number) => void; (cb: any): any; }
|
|
>cb : any
|
|
|
|
var r = foo1((x: number) => 1); // ok because base returns void
|
|
>r : (x: number) => void
|
|
>foo1((x: number) => 1) : (x: number) => void
|
|
>foo1 : { (cb: (x: number) => void): (x: number) => void; (cb: any): any; }
|
|
>(x: number) => 1 : (x: number) => number
|
|
>x : number
|
|
>1 : number
|
|
|
|
var r2 = foo1(<T>(x: T) => ''); // ok because base returns void
|
|
>r2 : (x: number) => void
|
|
>foo1(<T>(x: T) => '') : (x: number) => void
|
|
>foo1 : { (cb: (x: number) => void): (x: number) => void; (cb: any): any; }
|
|
><T>(x: T) => '' : <T>(x: T) => string
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
>'' : string
|
|
|
|
declare function foo2(cb: (x: number, y: number) => void): typeof cb;
|
|
>foo2 : { (cb: (x: number, y: number) => void): (x: number, y: number) => void; (cb: any): any; }
|
|
>cb : (x: number, y: number) => void
|
|
>x : number
|
|
>y : number
|
|
>cb : (x: number, y: number) => void
|
|
|
|
declare function foo2(cb: any): any;
|
|
>foo2 : { (cb: (x: number, y: number) => void): (x: number, y: number) => void; (cb: any): any; }
|
|
>cb : any
|
|
|
|
var r3 = foo2((x: number, y: number) => 1); // ok because base returns void
|
|
>r3 : (x: number, y: number) => void
|
|
>foo2((x: number, y: number) => 1) : (x: number, y: number) => void
|
|
>foo2 : { (cb: (x: number, y: number) => void): (x: number, y: number) => void; (cb: any): any; }
|
|
>(x: number, y: number) => 1 : (x: number, y: number) => number
|
|
>x : number
|
|
>y : number
|
|
>1 : number
|
|
|
|
var r4 = foo2(<T>(x: T) => ''); // ok because base returns void
|
|
>r4 : (x: number, y: number) => void
|
|
>foo2(<T>(x: T) => '') : (x: number, y: number) => void
|
|
>foo2 : { (cb: (x: number, y: number) => void): (x: number, y: number) => void; (cb: any): any; }
|
|
><T>(x: T) => '' : <T>(x: T) => string
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
>'' : string
|
|
}
|