File: unionTypeCallSignatures6.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (94 lines) | stat: -rw-r--r-- 4,485 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(11,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
  Type 'void' is not assignable to type 'A'.
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(13,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A'.
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(38,4): error TS2349: This expression is not callable.
  Each member of the union type 'F3 | F4' has signatures, but none of those signatures are compatible with each other.
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(39,1): error TS2684: The 'this' context of type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' is not assignable to method's 'this' of type 'B'.
  Property 'b' is missing in type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' but required in type 'B'.
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(48,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(55,1): error TS2769: No overload matches this call.
  Overload 1 of 2, '(this: A & B & C): void', gave the following error.
    The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B & C'.
      Type 'void' is not assignable to type 'A'.
  Overload 2 of 2, '(this: A & B): void', gave the following error.
    The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.


==== tests/cases/conformance/types/union/unionTypeCallSignatures6.ts (6 errors) ====
    type A = { a: string };
    type B = { b: number };
    type C = { c: string };
    type D = { d: number };
    type F0 = () => void;
    
    // #31547
    type F1 = (this: A) => void;
    type F2 = (this: B) => void;
    declare var f1: F1 | F2;
    f1(); // error
    ~~~~
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
!!! error TS2684:   Type 'void' is not assignable to type 'A'.
    declare var f2: F0 | F1;
    f2(); // error
    ~~~~
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A'.
    
    interface F3 {
      (this: A): void;
      (this: B): void;
    }
    interface F4 {
      (this: C): void;
      (this: D): void;
    }
    interface F5 {
      (this: C): void;
      (this: B): void;
    }
    
    declare var x1: A & C & {
      f0: F0 | F3;
      f1: F1 | F3;
      f2: F1 | F4;
      f3: F3 | F4;
      f4: F3 | F5;
    }
    x1.f0();
    x1.f1();
    x1.f2();
    x1.f3(); // error
       ~~
!!! error TS2349: This expression is not callable.
!!! error TS2349:   Each member of the union type 'F3 | F4' has signatures, but none of those signatures are compatible with each other.
    x1.f4(); // error
    ~~
!!! error TS2684: The 'this' context of type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' is not assignable to method's 'this' of type 'B'.
!!! error TS2684:   Property 'b' is missing in type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' but required in type 'B'.
!!! related TS2728 tests/cases/conformance/types/union/unionTypeCallSignatures6.ts:2:12: 'b' is declared here.
    
    declare var x2: A & B & {
      f4: F3 | F5;
    }
    x2.f4();
    
    type F6 = (this: A & B) => void;
    declare var f3: F1 | F6;
    f3(); // error
    ~~~~
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
    
    interface F7 {
      (this: A & B & C): void;
      (this: A & B): void;
    }
    declare var f4: F6 | F7;
    f4(); // error
    ~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769:   Overload 1 of 2, '(this: A & B & C): void', gave the following error.
!!! error TS2769:     The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B & C'.
!!! error TS2769:       Type 'void' is not assignable to type 'A'.
!!! error TS2769:   Overload 2 of 2, '(this: A & B): void', gave the following error.
!!! error TS2769:     The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.