TypeScript/tests/baselines/reference/typeConstraintsWithConstructSignatures.types

38 lines
1.9 KiB
Text
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/typeConstraintsWithConstructSignatures.ts ===
interface Constructable {
2015-04-13 23:01:57 +02:00
>Constructable : Constructable, Symbol(Constructable, Decl(typeConstraintsWithConstructSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
new (): any;
}
class C<T extends Constructable> {
2015-04-13 23:01:57 +02:00
>C : C<T>, Symbol(C, Decl(typeConstraintsWithConstructSignatures.ts, 2, 1))
>T : T, Symbol(T, Decl(typeConstraintsWithConstructSignatures.ts, 4, 8))
>Constructable : Constructable, Symbol(Constructable, Decl(typeConstraintsWithConstructSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
constructor(public data: T, public data2: Constructable) { }
2015-04-13 23:01:57 +02:00
>data : T, Symbol(data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16))
>T : T, Symbol(T, Decl(typeConstraintsWithConstructSignatures.ts, 4, 8))
>data2 : Constructable, Symbol(data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31))
>Constructable : Constructable, Symbol(Constructable, Decl(typeConstraintsWithConstructSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
create() {
2015-04-13 23:01:57 +02:00
>create : () => void, Symbol(create, Decl(typeConstraintsWithConstructSignatures.ts, 5, 64))
2014-08-15 23:33:16 +02:00
var x = new this.data(); // should not error
2015-04-13 23:01:57 +02:00
>x : any, Symbol(x, Decl(typeConstraintsWithConstructSignatures.ts, 7, 11))
2014-08-15 23:33:16 +02:00
>new this.data() : any
2015-04-13 23:01:57 +02:00
>this.data : T, Symbol(data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16))
>this : C<T>, Symbol(C, Decl(typeConstraintsWithConstructSignatures.ts, 2, 1))
>data : T, Symbol(data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16))
2014-08-15 23:33:16 +02:00
var x2 = new this.data2(); // should not error
2015-04-13 23:01:57 +02:00
>x2 : any, Symbol(x2, Decl(typeConstraintsWithConstructSignatures.ts, 8, 11))
2014-08-15 23:33:16 +02:00
>new this.data2() : any
2015-04-13 23:01:57 +02:00
>this.data2 : Constructable, Symbol(data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31))
>this : C<T>, Symbol(C, Decl(typeConstraintsWithConstructSignatures.ts, 2, 1))
>data2 : Constructable, Symbol(data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31))
2014-08-15 23:33:16 +02:00
}
}