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
|
tests/cases/compiler/genericAssignmentCompatOfFunctionSignatures1.ts(4,1): error TS2322: Type '<T, U extends { a: T; b: number; }>(x: T, z: U) => void' is not assignable to type '<T, U extends { a: T; b: string; }>(x: T, z: U) => void'.
Types of parameters 'z' and 'z' are incompatible.
Type 'U' is not assignable to type '{ a: T; b: number; }'.
Type '{ a: T; b: string; }' is not assignable to type '{ a: T; b: number; }'.
Types of property 'b' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/genericAssignmentCompatOfFunctionSignatures1.ts(5,1): error TS2322: Type '<T, U extends { a: T; b: string; }>(x: T, z: U) => void' is not assignable to type '<T, U extends { a: T; b: number; }>(x: T, z: U) => void'.
Types of parameters 'z' and 'z' are incompatible.
Type 'U' is not assignable to type '{ a: T; b: string; }'.
Type '{ a: T; b: number; }' is not assignable to type '{ a: T; b: string; }'.
Types of property 'b' are incompatible.
Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/genericAssignmentCompatOfFunctionSignatures1.ts (2 errors) ====
var x1 = function foo3<T, U extends { a: T; b: string }>(x: T, z: U) { }
var x2 = function foo3<T, U extends { a: T; b: number }>(x: T, z: U) { }
x1 = x2;
~~
!!! error TS2322: Type '<T, U extends { a: T; b: number; }>(x: T, z: U) => void' is not assignable to type '<T, U extends { a: T; b: string; }>(x: T, z: U) => void'.
!!! error TS2322: Types of parameters 'z' and 'z' are incompatible.
!!! error TS2322: Type 'U' is not assignable to type '{ a: T; b: number; }'.
!!! error TS2322: Type '{ a: T; b: string; }' is not assignable to type '{ a: T; b: number; }'.
!!! error TS2322: Types of property 'b' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
x2 = x1;
~~
!!! error TS2322: Type '<T, U extends { a: T; b: string; }>(x: T, z: U) => void' is not assignable to type '<T, U extends { a: T; b: number; }>(x: T, z: U) => void'.
!!! error TS2322: Types of parameters 'z' and 'z' are incompatible.
!!! error TS2322: Type 'U' is not assignable to type '{ a: T; b: string; }'.
!!! error TS2322: Type '{ a: T; b: number; }' is not assignable to type '{ a: T; b: string; }'.
!!! error TS2322: Types of property 'b' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|