File: assignmentCompatWithGenericCallSignatures2.errors.txt

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (37 lines) | stat: -rw-r--r-- 1,848 bytes parent folder | download | duplicates (3)
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
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/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[]'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/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[]'.


==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/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
    }
    
    var a: A;
    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 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures2.ts:8:6: This type parameter might need an `extends S[]` constraint.