39 lines
804 B
Plaintext
39 lines
804 B
Plaintext
|
=== tests/cases/compiler/genericTypeWithCallableMembers.ts ===
|
||
|
interface Constructable {
|
||
|
>Constructable : Constructable
|
||
|
|
||
|
new (): Constructable;
|
||
|
>Constructable : Constructable
|
||
|
}
|
||
|
|
||
|
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(); // no error
|
||
|
>x : Constructable
|
||
|
>new this.data() : Constructable
|
||
|
>this.data : T
|
||
|
>this : C<T>
|
||
|
>data : T
|
||
|
|
||
|
var x2 = new this.data2(); // was error, shouldn't be
|
||
|
>x2 : Constructable
|
||
|
>new this.data2() : Constructable
|
||
|
>this.data2 : Constructable
|
||
|
>this : C<T>
|
||
|
>data2 : Constructable
|
||
|
}
|
||
|
}
|
||
|
|