TypeScript/tests/baselines/reference/subtypingWithConstructSignatures.types

71 lines
5.3 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures.ts ===
module ConstructSignature {
2015-04-13 23:01:57 +02:00
>ConstructSignature : typeof ConstructSignature, Symbol(ConstructSignature, Decl(subtypingWithConstructSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
declare function foo1(cb: new (x: number) => void): typeof cb;
2015-04-13 23:01:57 +02:00
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>cb : new (x: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 1, 26))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 1, 35))
>cb : new (x: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 1, 26))
2014-08-15 23:33:16 +02:00
declare function foo1(cb: any): any;
2015-04-13 23:01:57 +02:00
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>cb : any, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 2, 26))
2014-08-15 23:33:16 +02:00
var rarg1: new (x: number) => number;
2015-04-13 23:01:57 +02:00
>rarg1 : new (x: number) => number, Symbol(rarg1, Decl(subtypingWithConstructSignatures.ts, 3, 7))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 3, 20))
2014-08-15 23:33:16 +02:00
var r = foo1(rarg1); // ok because base returns void
2015-04-13 23:01:57 +02:00
>r : new (x: number) => void, Symbol(r, Decl(subtypingWithConstructSignatures.ts, 4, 7))
2014-08-15 23:33:16 +02:00
>foo1(rarg1) : new (x: number) => void
2015-04-13 23:01:57 +02:00
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>rarg1 : new (x: number) => number, Symbol(rarg1, Decl(subtypingWithConstructSignatures.ts, 3, 7))
2014-08-15 23:33:16 +02:00
var rarg2: new <T>(x: T) => string;
2015-04-13 23:01:57 +02:00
>rarg2 : new <T>(x: T) => string, Symbol(rarg2, Decl(subtypingWithConstructSignatures.ts, 5, 7))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 5, 20))
>x : T, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 5, 23))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 5, 20))
2014-08-15 23:33:16 +02:00
var r2 = foo1(rarg2); // ok because base returns void
2015-04-13 23:01:57 +02:00
>r2 : new (x: number) => void, Symbol(r2, Decl(subtypingWithConstructSignatures.ts, 6, 7))
2014-08-15 23:33:16 +02:00
>foo1(rarg2) : new (x: number) => void
2015-04-13 23:01:57 +02:00
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>rarg2 : new <T>(x: T) => string, Symbol(rarg2, Decl(subtypingWithConstructSignatures.ts, 5, 7))
2014-08-15 23:33:16 +02:00
declare function foo2(cb: new (x: number, y: number) => void): typeof cb;
2015-04-13 23:01:57 +02:00
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>cb : new (x: number, y: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 8, 26))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 8, 35))
>y : number, Symbol(y, Decl(subtypingWithConstructSignatures.ts, 8, 45))
>cb : new (x: number, y: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 8, 26))
2014-08-15 23:33:16 +02:00
declare function foo2(cb: any): any;
2015-04-13 23:01:57 +02:00
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>cb : any, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 9, 26))
2014-08-15 23:33:16 +02:00
var r3arg1: new (x: number, y: number) => number;
2015-04-13 23:01:57 +02:00
>r3arg1 : new (x: number, y: number) => number, Symbol(r3arg1, Decl(subtypingWithConstructSignatures.ts, 10, 7))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 10, 21))
>y : number, Symbol(y, Decl(subtypingWithConstructSignatures.ts, 10, 31))
2014-08-15 23:33:16 +02:00
var r3 = foo2(r3arg1); // ok because base returns void
2015-04-13 23:01:57 +02:00
>r3 : new (x: number, y: number) => void, Symbol(r3, Decl(subtypingWithConstructSignatures.ts, 11, 7))
2014-08-15 23:33:16 +02:00
>foo2(r3arg1) : new (x: number, y: number) => void
2015-04-13 23:01:57 +02:00
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>r3arg1 : new (x: number, y: number) => number, Symbol(r3arg1, Decl(subtypingWithConstructSignatures.ts, 10, 7))
2014-08-15 23:33:16 +02:00
var r4arg1: new <T>(x: T) => string;
2015-04-13 23:01:57 +02:00
>r4arg1 : new <T>(x: T) => string, Symbol(r4arg1, Decl(subtypingWithConstructSignatures.ts, 12, 7))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 12, 21))
>x : T, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 12, 24))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 12, 21))
2014-08-15 23:33:16 +02:00
var r4 = foo2(r4arg1); // ok because base returns void
2015-04-13 23:01:57 +02:00
>r4 : new (x: number, y: number) => void, Symbol(r4, Decl(subtypingWithConstructSignatures.ts, 13, 7))
2014-08-15 23:33:16 +02:00
>foo2(r4arg1) : new (x: number, y: number) => void
2015-04-13 23:01:57 +02:00
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>r4arg1 : new <T>(x: T) => string, Symbol(r4arg1, Decl(subtypingWithConstructSignatures.ts, 12, 7))
2014-08-15 23:33:16 +02:00
}