Files
tsgo/testdata/baselines/reference/submodule/conformance/assignmentCompatWithGenericCallSignatures2.errors.txt
90b40e8b21 Sort by type depth in inferFromMatchingTypes function (#4591)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: ahejlsberg <[email protected]>
2026-07-21 15:55:00 +00:00

37 lines
1.5 KiB
Plaintext

assignmentCompatWithGenericCallSignatures2.ts(15,1): error TS2322: Type 'B' is not assignable to type 'A'.
Types of parameters 'y' and 'y' are incompatible.
Type 'T[]' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'T[]'.
assignmentCompatWithGenericCallSignatures2.ts(16,1): error TS2322: Type 'A' is not assignable to type 'B'.
Types of parameters 'y' and 'y' are incompatible.
Type 'S' is not assignable to type 'S[]'.
==== assignmentCompatWithGenericCallSignatures2.ts (2 errors) ====
// some complex cases of assignment compat of generic signatures. No contextual signature instantiation
interface A {
<T>(x: T, ...y: T[][]): void
}
interface B {
<S>(x: S, ...y: S[]): void
}
declare var a: A;
declare var b: B;
// Both errors
a = b;
~
!!! error TS2322: Type 'B' is not assignable to type 'A'.
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type 'T[]' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'T[]'.
b = a;
~
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type 'S' is not assignable to type 'S[]'.
!!! related TS2208 assignmentCompatWithGenericCallSignatures2.ts:8:6: This type parameter might need an `extends S[]` constraint.