TypeScript/tests/baselines/reference/typeConstraintsWithConstructSignatures.types

38 lines
730 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/typeConstraintsWithConstructSignatures.ts ===
interface Constructable {
>Constructable : Constructable
2014-08-15 23:33:16 +02:00
new (): any;
}
class C<T extends Constructable> {
>C : C<T>
>T : T
>Constructable : Constructable
2014-08-15 23:33:16 +02:00
constructor(public data: T, public data2: Constructable) { }
>data : T
>T : T
>data2 : Constructable
>Constructable : Constructable
2014-08-15 23:33:16 +02:00
create() {
>create : () => void
2014-08-15 23:33:16 +02:00
var x = new this.data(); // should not error
>x : any
2014-08-15 23:33:16 +02:00
>new this.data() : any
>this.data : T
>this : C<T>
>data : T
2014-08-15 23:33:16 +02:00
var x2 = new this.data2(); // should not error
>x2 : any
2014-08-15 23:33:16 +02:00
>new this.data2() : any
>this.data2 : Constructable
>this : C<T>
>data2 : Constructable
2014-08-15 23:33:16 +02:00
}
}