2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts ===
|
|
|
|
// basic uses of specialized signatures without errors
|
|
|
|
|
|
|
|
class Base { foo: string }
|
2015-04-13 23:01:57 +02:00
|
|
|
>Base : Base, Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0))
|
|
|
|
>foo : string, Symbol(foo, Decl(typesWithSpecializedConstructSignatures.ts, 2, 12))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
class Derived1 extends Base { bar: string }
|
2015-04-13 23:01:57 +02:00
|
|
|
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedConstructSignatures.ts, 2, 26))
|
|
|
|
>Base : Base, Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0))
|
|
|
|
>bar : string, Symbol(bar, Decl(typesWithSpecializedConstructSignatures.ts, 3, 29))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
class Derived2 extends Base { baz: string }
|
2015-04-13 23:01:57 +02:00
|
|
|
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedConstructSignatures.ts, 3, 43))
|
|
|
|
>Base : Base, Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0))
|
|
|
|
>baz : string, Symbol(baz, Decl(typesWithSpecializedConstructSignatures.ts, 4, 29))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
class C {
|
2015-04-13 23:01:57 +02:00
|
|
|
>C : C, Symbol(C, Decl(typesWithSpecializedConstructSignatures.ts, 4, 43))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x: 'hi');
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : 'hi', Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 7, 16))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x: 'bye');
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : 'bye', Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 8, 16))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x: string);
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : string, Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 9, 16))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x) {
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : any, Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 10, 16))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
return x;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : any, Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 10, 16))
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
var c = new C('a');
|
2015-04-13 23:01:57 +02:00
|
|
|
>c : C, Symbol(c, Decl(typesWithSpecializedConstructSignatures.ts, 14, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new C('a') : C
|
2015-04-13 23:01:57 +02:00
|
|
|
>C : typeof C, Symbol(C, Decl(typesWithSpecializedConstructSignatures.ts, 4, 43))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'a' : string
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
interface I {
|
2015-04-13 23:01:57 +02:00
|
|
|
>I : I, Symbol(I, Decl(typesWithSpecializedConstructSignatures.ts, 14, 19))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: 'hi'): Derived1;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : 'hi', Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 17, 8))
|
|
|
|
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedConstructSignatures.ts, 2, 26))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: 'bye'): Derived2;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : 'bye', Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 18, 8))
|
|
|
|
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedConstructSignatures.ts, 3, 43))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: string): Base;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : string, Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 19, 8))
|
|
|
|
>Base : Base, Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
var i: I;
|
2015-04-13 23:01:57 +02:00
|
|
|
>i : I, Symbol(i, Decl(typesWithSpecializedConstructSignatures.ts, 21, 3))
|
|
|
|
>I : I, Symbol(I, Decl(typesWithSpecializedConstructSignatures.ts, 14, 19))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var a: {
|
2015-04-13 23:01:57 +02:00
|
|
|
>a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; }, Symbol(a, Decl(typesWithSpecializedConstructSignatures.ts, 23, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: 'hi'): Derived1;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : 'hi', Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 24, 8))
|
|
|
|
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedConstructSignatures.ts, 2, 26))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: 'bye'): Derived2;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : 'bye', Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 25, 8))
|
|
|
|
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedConstructSignatures.ts, 3, 43))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: string): Base;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : string, Symbol(x, Decl(typesWithSpecializedConstructSignatures.ts, 26, 8))
|
|
|
|
>Base : Base, Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
c = i;
|
|
|
|
>c = i : I
|
2015-04-13 23:01:57 +02:00
|
|
|
>c : C, Symbol(c, Decl(typesWithSpecializedConstructSignatures.ts, 14, 3))
|
|
|
|
>i : I, Symbol(i, Decl(typesWithSpecializedConstructSignatures.ts, 21, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
c = a;
|
|
|
|
>c = a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>c : C, Symbol(c, Decl(typesWithSpecializedConstructSignatures.ts, 14, 3))
|
|
|
|
>a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; }, Symbol(a, Decl(typesWithSpecializedConstructSignatures.ts, 23, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
i = a;
|
|
|
|
>i = a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>i : I, Symbol(i, Decl(typesWithSpecializedConstructSignatures.ts, 21, 3))
|
|
|
|
>a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; }, Symbol(a, Decl(typesWithSpecializedConstructSignatures.ts, 23, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
a = i;
|
|
|
|
>a = i : I
|
2015-04-13 23:01:57 +02:00
|
|
|
>a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; }, Symbol(a, Decl(typesWithSpecializedConstructSignatures.ts, 23, 3))
|
|
|
|
>i : I, Symbol(i, Decl(typesWithSpecializedConstructSignatures.ts, 21, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var r1 = new C('hi');
|
2015-04-13 23:01:57 +02:00
|
|
|
>r1 : C, Symbol(r1, Decl(typesWithSpecializedConstructSignatures.ts, 36, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new C('hi') : C
|
2015-04-13 23:01:57 +02:00
|
|
|
>C : typeof C, Symbol(C, Decl(typesWithSpecializedConstructSignatures.ts, 4, 43))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'hi' : string
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var r2: Derived2 = new i('bye');
|
2015-04-13 23:01:57 +02:00
|
|
|
>r2 : Derived2, Symbol(r2, Decl(typesWithSpecializedConstructSignatures.ts, 37, 3))
|
|
|
|
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedConstructSignatures.ts, 3, 43))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new i('bye') : Derived2
|
2015-04-13 23:01:57 +02:00
|
|
|
>i : I, Symbol(i, Decl(typesWithSpecializedConstructSignatures.ts, 21, 3))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'bye' : string
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var r3: Base = new a('hm');
|
2015-04-13 23:01:57 +02:00
|
|
|
>r3 : Base, Symbol(r3, Decl(typesWithSpecializedConstructSignatures.ts, 38, 3))
|
|
|
|
>Base : Base, Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new a('hm') : Base
|
2015-04-13 23:01:57 +02:00
|
|
|
>a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; }, Symbol(a, Decl(typesWithSpecializedConstructSignatures.ts, 23, 3))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'hm' : string
|
2014-08-15 23:33:16 +02:00
|
|
|
|