2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/genericClasses2.ts ===
|
|
|
|
interface Foo<T> {
|
|
|
|
>Foo : Foo<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
a: T;
|
|
|
|
>a : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
|
|
|
|
class C<T> {
|
|
|
|
>C : C<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
public x: T;
|
|
|
|
>x : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
public y: Foo<T>;
|
|
|
|
>y : Foo<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Foo : Foo<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
public z: Foo<number>;
|
|
|
|
>z : Foo<number>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Foo : Foo<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var v1 : C<string>;
|
|
|
|
>v1 : C<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>C : C<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var y = v1.x; // should be 'string'
|
|
|
|
>y : string
|
|
|
|
>v1.x : string
|
|
|
|
>v1 : C<string>
|
|
|
|
>x : string
|
|
|
|
|
|
|
|
var w = v1.y.a; // should be 'string'
|
|
|
|
>w : string
|
|
|
|
>v1.y.a : string
|
|
|
|
>v1.y : Foo<string>
|
|
|
|
>v1 : C<string>
|
|
|
|
>y : Foo<string>
|
|
|
|
>a : string
|
|
|
|
|
|
|
|
var z = v1.z.a; // should be 'number'
|
|
|
|
>z : number
|
|
|
|
>v1.z.a : number
|
|
|
|
>v1.z : Foo<number>
|
|
|
|
>v1 : C<string>
|
|
|
|
>z : Foo<number>
|
|
|
|
>a : number
|
|
|
|
|