2014-09-12 22:35:07 +02:00
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(1,12): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(2,27): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/typeParamExtendsOtherTypeParam.ts (2 errors) ====
class A<T, U extends T> { }
~~~~~~~~~~~
2014-09-12 00:19:57 +02:00
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
class B<T extends Object, U extends T> {
~~~~~~~~~~~
2014-09-12 00:19:57 +02:00
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
data: A<Object, Object>;
}
// Below 2 should compile without error
var x: A< { a: string }, { a: string; b: number }>;
var y: B< { a: string }, { a: string; b: number }>;
// Below should be in error
var x1: A<{ a: string;}, { b: string }>;
var x2: A<{ a: string;}, { a: number }>;
var x3: B<{ a: string;}, { b: string }>;
var x4: B<{ a: string;}, { a: number }>;
var x5: A<{ a: string; b: number }, { a: string }>;
var x6: B<{ a: string; b: number }, { a: string }>;
interface I1 {
a: string;
}
interface I2 {
a: string;
b: number;
}
var x7: A<I2, I1>;
var x8: B<I2, I1>;