2014-07-13 01:04:16 +02:00
|
|
|
//// [typeParameterAsTypeArgument.ts]
|
|
|
|
// These are all errors because type parameters cannot reference other type parameters from the same list
|
|
|
|
|
|
|
|
function foo<T, U>(x: T, y: U) {
|
|
|
|
foo<U, U>(y, y);
|
|
|
|
return new C<U,T>();
|
|
|
|
}
|
|
|
|
|
|
|
|
class C<T, U> {
|
|
|
|
x: T;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface I<T, U> {
|
|
|
|
x: C<U, T>;
|
|
|
|
}
|
|
|
|
|
|
|
|
//function foo<T, U extends T>(x: T, y: U) {
|
|
|
|
// foo<U, U>(y, y);
|
|
|
|
// return new C<U, T>();
|
|
|
|
//}
|
|
|
|
|
|
|
|
//class C<T extends U, U> {
|
|
|
|
// x: T;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//interface I<T, U extends T> {
|
|
|
|
// x: C<U, T>;
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//// [typeParameterAsTypeArgument.js]
|
2014-08-14 15:21:30 +02:00
|
|
|
// These are all errors because type parameters cannot reference other type parameters from the same list
|
2014-07-13 01:04:16 +02:00
|
|
|
function foo(x, y) {
|
|
|
|
foo(y, y);
|
|
|
|
return new C();
|
|
|
|
}
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
|
|
|
return C;
|
|
|
|
})();
|
2014-12-03 01:09:41 +01:00
|
|
|
//function foo<T, U extends T>(x: T, y: U) {
|
|
|
|
// foo<U, U>(y, y);
|
|
|
|
// return new C<U, T>();
|
|
|
|
//}
|
|
|
|
//class C<T extends U, U> {
|
|
|
|
// x: T;
|
|
|
|
//}
|
|
|
|
//interface I<T, U extends T> {
|
|
|
|
// x: C<U, T>;
|
|
|
|
//}
|