1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(12,26): error TS2344: Type '{ b: string; }' does not satisfy the constraint '{ a: string; }'.
Property 'a' is missing in type '{ b: string; }' but required in type '{ a: string; }'.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(13,26): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: string; }'.
Types of property 'a' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(14,26): error TS2344: Type '{ b: string; }' does not satisfy the constraint '{ a: string; }'.
Property 'a' is missing in type '{ b: string; }' but required in type '{ a: string; }'.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(15,26): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: string; }'.
Types of property 'a' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(16,37): error TS2344: Type '{ a: string; }' does not satisfy the constraint '{ a: string; b: number; }'.
Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: number; }'.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(17,37): error TS2344: Type '{ a: string; }' does not satisfy the constraint '{ a: string; b: number; }'.
Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: number; }'.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(28,15): error TS2344: Type 'I1' does not satisfy the constraint 'I2'.
Property 'b' is missing in type 'I1' but required in type 'I2'.
tests/cases/compiler/typeParamExtendsOtherTypeParam.ts(29,15): error TS2344: Type 'I1' does not satisfy the constraint 'I2'.
==== tests/cases/compiler/typeParamExtendsOtherTypeParam.ts (8 errors) ====
class A<T, U extends T> { }
class B<T extends Object, U extends T> {
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 }>;
~~~~~~~~~~~~~
!!! error TS2344: Type '{ b: string; }' does not satisfy the constraint '{ a: string; }'.
!!! error TS2344: Property 'a' is missing in type '{ b: string; }' but required in type '{ a: string; }'.
!!! related TS2728 tests/cases/compiler/typeParamExtendsOtherTypeParam.ts:12:13: 'a' is declared here.
var x2: A<{ a: string;}, { a: number }>;
~~~~~~~~~~~~~
!!! error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: string; }'.
!!! error TS2344: Types of property 'a' are incompatible.
!!! error TS2344: Type 'number' is not assignable to type 'string'.
var x3: B<{ a: string;}, { b: string }>;
~~~~~~~~~~~~~
!!! error TS2344: Type '{ b: string; }' does not satisfy the constraint '{ a: string; }'.
!!! error TS2344: Property 'a' is missing in type '{ b: string; }' but required in type '{ a: string; }'.
!!! related TS2728 tests/cases/compiler/typeParamExtendsOtherTypeParam.ts:14:13: 'a' is declared here.
var x4: B<{ a: string;}, { a: number }>;
~~~~~~~~~~~~~
!!! error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: string; }'.
!!! error TS2344: Types of property 'a' are incompatible.
!!! error TS2344: Type 'number' is not assignable to type 'string'.
var x5: A<{ a: string; b: number }, { a: string }>;
~~~~~~~~~~~~~
!!! error TS2344: Type '{ a: string; }' does not satisfy the constraint '{ a: string; b: number; }'.
!!! error TS2344: Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: number; }'.
!!! related TS2728 tests/cases/compiler/typeParamExtendsOtherTypeParam.ts:16:24: 'b' is declared here.
var x6: B<{ a: string; b: number }, { a: string }>;
~~~~~~~~~~~~~
!!! error TS2344: Type '{ a: string; }' does not satisfy the constraint '{ a: string; b: number; }'.
!!! error TS2344: Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: number; }'.
!!! related TS2728 tests/cases/compiler/typeParamExtendsOtherTypeParam.ts:17:24: 'b' is declared here.
interface I1 {
a: string;
}
interface I2 {
a: string;
b: number;
}
var x7: A<I2, I1>;
~~
!!! error TS2344: Type 'I1' does not satisfy the constraint 'I2'.
!!! error TS2344: Property 'b' is missing in type 'I1' but required in type 'I2'.
!!! related TS2728 tests/cases/compiler/typeParamExtendsOtherTypeParam.ts:25:5: 'b' is declared here.
var x8: B<I2, I1>;
~~
!!! error TS2344: Type 'I1' does not satisfy the constraint 'I2'.
|