133 lines
No EOL
6.1 KiB
Text
133 lines
No EOL
6.1 KiB
Text
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(45,7): error TS2415: Class 'D3<T, U, V>' incorrectly extends base class 'B1<Foo>'.
|
|
Types of property 'foo' are incompatible.
|
|
Type 'V' is not assignable to type 'Foo'.
|
|
Property 'foo' is missing in type '{}'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(47,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'Foo'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(55,7): error TS2415: Class 'D5<T, U, V>' incorrectly extends base class 'B1<T>'.
|
|
Types of property 'foo' are incompatible.
|
|
Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(60,7): error TS2415: Class 'D6<T, U, V>' incorrectly extends base class 'B1<T>'.
|
|
Types of property 'foo' are incompatible.
|
|
Type 'V' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(62,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(65,7): error TS2415: Class 'D7<T, U, V>' incorrectly extends base class 'B1<U>'.
|
|
Types of property 'foo' are incompatible.
|
|
Type 'T' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(75,7): error TS2415: Class 'D9<T, U, V>' incorrectly extends base class 'B1<U>'.
|
|
Types of property 'foo' are incompatible.
|
|
Type 'V' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(77,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts (10 errors) ====
|
|
// checking whether other types are subtypes of type parameters with constraints
|
|
|
|
class Foo { foo: number; }
|
|
function f<T extends Foo, U extends Foo, V>(t: T, u: U, v: V) {
|
|
// ok
|
|
var r = true ? t : u;
|
|
var r = true ? u : t;
|
|
|
|
// ok
|
|
var r2 = true ? t : v;
|
|
var r2 = true ? v : t;
|
|
|
|
// ok
|
|
var r3 = true ? v : u;
|
|
var r3 = true ? u : v;
|
|
|
|
// ok
|
|
var r4 = true ? t : new Foo();
|
|
var r4 = true ? new Foo() : t;
|
|
|
|
// ok
|
|
var r5 = true ? u : new Foo();
|
|
var r5 = true ? new Foo() : u;
|
|
|
|
// ok
|
|
var r6 = true ? v : new Foo();
|
|
var r6 = true ? new Foo() : v;
|
|
|
|
}
|
|
|
|
class B1<T> {
|
|
foo: T;
|
|
}
|
|
|
|
class D1<T extends Foo, U extends Foo, V> extends B1<Foo> {
|
|
[x: string]: Foo;
|
|
foo: T; // ok
|
|
}
|
|
|
|
class D2<T extends Foo, U extends Foo, V> extends B1<Foo> {
|
|
[x: string]: Foo;
|
|
foo: U; // ok
|
|
}
|
|
|
|
class D3<T extends Foo, U extends Foo, V> extends B1<Foo> {
|
|
~~
|
|
!!! error TS2415: Class 'D3<T, U, V>' incorrectly extends base class 'B1<Foo>'.
|
|
!!! error TS2415: Types of property 'foo' are incompatible.
|
|
!!! error TS2415: Type 'V' is not assignable to type 'Foo'.
|
|
!!! error TS2415: Property 'foo' is missing in type '{}'.
|
|
[x: string]: Foo;
|
|
foo: V; // error
|
|
~~~~~~~
|
|
!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'Foo'.
|
|
}
|
|
|
|
class D4<T extends Foo, U extends Foo, V> extends B1<T> {
|
|
[x: string]: T;
|
|
foo: T; // ok
|
|
}
|
|
|
|
class D5<T extends Foo, U extends Foo, V> extends B1<T> {
|
|
~~
|
|
!!! error TS2415: Class 'D5<T, U, V>' incorrectly extends base class 'B1<T>'.
|
|
!!! error TS2415: Types of property 'foo' are incompatible.
|
|
!!! error TS2415: Type 'U' is not assignable to type 'T'.
|
|
[x: string]: T;
|
|
foo: U; // error
|
|
~~~~~~~
|
|
!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'.
|
|
}
|
|
|
|
class D6<T extends Foo, U extends Foo, V> extends B1<T> {
|
|
~~
|
|
!!! error TS2415: Class 'D6<T, U, V>' incorrectly extends base class 'B1<T>'.
|
|
!!! error TS2415: Types of property 'foo' are incompatible.
|
|
!!! error TS2415: Type 'V' is not assignable to type 'T'.
|
|
[x: string]: T;
|
|
foo: V; // error
|
|
~~~~~~~
|
|
!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
|
|
}
|
|
|
|
class D7<T extends Foo, U extends Foo, V> extends B1<U> {
|
|
~~
|
|
!!! error TS2415: Class 'D7<T, U, V>' incorrectly extends base class 'B1<U>'.
|
|
!!! error TS2415: Types of property 'foo' are incompatible.
|
|
!!! error TS2415: Type 'T' is not assignable to type 'U'.
|
|
[x: string]: U;
|
|
foo: T; // error
|
|
~~~~~~~
|
|
!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'.
|
|
}
|
|
|
|
class D8<T extends Foo, U extends Foo, V> extends B1<U> {
|
|
[x: string]: U;
|
|
foo: U; // ok
|
|
}
|
|
|
|
class D9<T extends Foo, U extends Foo, V> extends B1<U> {
|
|
~~
|
|
!!! error TS2415: Class 'D9<T, U, V>' incorrectly extends base class 'B1<U>'.
|
|
!!! error TS2415: Types of property 'foo' are incompatible.
|
|
!!! error TS2415: Type 'V' is not assignable to type 'U'.
|
|
[x: string]: U;
|
|
foo: V; // error
|
|
~~~~~~~
|
|
!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
|
|
} |