2014-07-13 01:04:16 +02:00
|
|
|
//// [genericClasses2.ts]
|
|
|
|
interface Foo<T> {
|
|
|
|
a: T;
|
|
|
|
}
|
|
|
|
|
|
|
|
class C<T> {
|
|
|
|
public x: T;
|
|
|
|
public y: Foo<T>;
|
|
|
|
public z: Foo<number>;
|
|
|
|
}
|
|
|
|
|
|
|
|
var v1 : C<string>;
|
|
|
|
|
|
|
|
var y = v1.x; // should be 'string'
|
|
|
|
var w = v1.y.a; // should be 'string'
|
|
|
|
var z = v1.z.a; // should be 'number'
|
|
|
|
|
|
|
|
//// [genericClasses2.js]
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var v1;
|
2014-08-14 18:47:50 +02:00
|
|
|
var y = v1.x;// should be 'string'
|
|
|
|
var w = v1.y.a;// should be 'string'
|
|
|
|
var z = v1.z.a;// should be 'number'
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
//// [genericClasses2.d.ts]
|
2014-07-11 23:44:31 +02:00
|
|
|
interface Foo<T> {
|
2014-07-12 01:36:06 +02:00
|
|
|
a: T;
|
2014-07-11 23:44:31 +02:00
|
|
|
}
|
|
|
|
declare class C<T> {
|
2014-07-12 01:36:06 +02:00
|
|
|
x: T;
|
|
|
|
y: Foo<T>;
|
|
|
|
z: Foo<number>;
|
2014-07-11 23:44:31 +02:00
|
|
|
}
|
2014-07-12 01:36:06 +02:00
|
|
|
declare var v1: C<string>;
|
|
|
|
declare var y: string;
|
|
|
|
declare var w: string;
|
|
|
|
declare var z: number;
|