tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts(7,7): error TS2415: Class 'D1' incorrectly extends base class 'C3'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts(95,21): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts (2 errors) ==== // checking whether other types are subtypes of type parameters class C3 { foo: T; } class D1 extends C3 { ~~ !!! error TS2415: Class 'D1' incorrectly extends base class 'C3'. !!! error TS2415: Types of property 'foo' are incompatible. !!! error TS2415: Type 'U' is not assignable to type 'T'. foo: U; // error } function f1(x: T, y: U) { var r = true ? x : y; // error var r = true ? y : x; // error } interface I1 { foo: number; } class C1 { foo: number; } class C2 { foo: T; } enum E { A } function f() { } module f { export var bar = 1; } class c { baz: string } module c { export var bar = 1; } // errors throughout function f2(x: T, y: U) { var r0 = true ? x : null; var r0 = true ? null : x; var u: typeof undefined; var r0b = true ? u : x; var r0b = true ? x : u; var r1 = true ? 1 : x; var r1 = true ? x : 1; var r2 = true ? '' : x; var r2 = true ? x : ''; var r3 = true ? true : x; var r3 = true ? x : true; var r4 = true ? new Date() : x; var r4 = true ? x : new Date(); var r5 = true ? /1/ : x; var r5 = true ? x : /1/; var r6 = true ? { foo: 1 } : x; var r6 = true ? x : { foo: 1 }; var r7 = true ? () => { } : x; var r7 = true ? x : () => { }; var r8 = true ? (x: T) => { return x } : x; var r8b = true ? x : (x: T) => { return x }; // type parameters not identical across declarations var i1: I1; var r9 = true ? i1 : x; var r9 = true ? x : i1; var c1: C1; var r10 = true ? c1 : x; var r10 = true ? x : c1; var c2: C2; var r12 = true ? c2 : x; var r12 = true ? x : c2; var r13 = true ? E : x; var r13 = true ? x : E; var r14 = true ? E.A : x; var r14 = true ? x : E.A; var af: typeof f; var r15 = true ? af : x; var r15 = true ? x : af; var ac: typeof c; var r16 = true ? ac : x; var r16 = true ? x : ac; function f17(a: T) { var r17 = true ? x : a; var r17 = true ? a : x; } function f18(a: U) { ~~~~~~~~~~~ !!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var r18 = true ? x : a; var r18 = true ? a : x; } var r19 = true ? new Object() : x; // BCT is Object var r19 = true ? x : new Object(); // BCT is Object var r20 = true ? {} : x; // ok var r20 = true ? x : {}; // ok }