mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
90b40e8b21
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ahejlsberg <[email protected]>
37 lines
1.5 KiB
Plaintext
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.
|
|
|