38 lines
730 B
Text
38 lines
730 B
Text
|
=== tests/cases/compiler/typeConstraintsWithConstructSignatures.ts ===
|
||
|
interface Constructable {
|
||
|
>Constructable : Constructable
|
||
|
|
||
|
new (): any;
|
||
|
}
|
||
|
|
||
|
class C<T extends Constructable> {
|
||
|
>C : C<T>
|
||
|
>T : T
|
||
|
>Constructable : Constructable
|
||
|
|
||
|
constructor(public data: T, public data2: Constructable) { }
|
||
|
>data : T
|
||
|
>T : T
|
||
|
>data2 : Constructable
|
||
|
>Constructable : Constructable
|
||
|
|
||
|
create() {
|
||
|
>create : () => void
|
||
|
|
||
|
var x = new this.data(); // should not error
|
||
|
>x : any
|
||
|
>new this.data() : any
|
||
|
>this.data : T
|
||
|
>this : C<T>
|
||
|
>data : T
|
||
|
|
||
|
var x2 = new this.data2(); // should not error
|
||
|
>x2 : any
|
||
|
>new this.data2() : any
|
||
|
>this.data2 : Constructable
|
||
|
>this : C<T>
|
||
|
>data2 : Constructable
|
||
|
}
|
||
|
}
|
||
|
|