|
| 1 | +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'. |
| 2 | + Type 'void' is not assignable to type 'A'. |
| 3 | +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'. |
| 4 | +tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(38,4): error TS2349: This expression is not callable. |
| 5 | + Each member of the union type 'F3 | F4' has signatures, but none of those signatures are compatible with each other. |
| 6 | +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'. |
| 7 | + 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'. |
| 8 | +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'. |
| 9 | + Type 'void' is not assignable to type 'A'. |
| 10 | +tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(55,1): error TS2769: No overload matches this call. |
| 11 | + Overload 1 of 2, '(this: A & B & C): void', gave the following error. |
| 12 | + The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B & C'. |
| 13 | + Type 'void' is not assignable to type 'A'. |
| 14 | + Overload 2 of 2, '(this: A & B): void', gave the following error. |
| 15 | + The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. |
| 16 | + Type 'void' is not assignable to type 'A'. |
| 17 | + |
| 18 | + |
| 19 | +==== tests/cases/conformance/types/union/unionTypeCallSignatures6.ts (6 errors) ==== |
| 20 | + type A = { a: string }; |
| 21 | + type B = { b: number }; |
| 22 | + type C = { c: string }; |
| 23 | + type D = { d: number }; |
| 24 | + type F0 = () => void; |
| 25 | + |
| 26 | + // #31547 |
| 27 | + type F1 = (this: A) => void; |
| 28 | + type F2 = (this: B) => void; |
| 29 | + declare var f1: F1 | F2; |
| 30 | + f1(); // error |
| 31 | + ~~~~ |
| 32 | +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. |
| 33 | +!!! error TS2684: Type 'void' is not assignable to type 'A'. |
| 34 | + declare var f2: F0 | F1; |
| 35 | + f2(); // error |
| 36 | + ~~~~ |
| 37 | +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A'. |
| 38 | + |
| 39 | + interface F3 { |
| 40 | + (this: A): void; |
| 41 | + (this: B): void; |
| 42 | + } |
| 43 | + interface F4 { |
| 44 | + (this: C): void; |
| 45 | + (this: D): void; |
| 46 | + } |
| 47 | + interface F5 { |
| 48 | + (this: C): void; |
| 49 | + (this: B): void; |
| 50 | + } |
| 51 | + |
| 52 | + declare var x1: A & C & { |
| 53 | + f0: F0 | F3; |
| 54 | + f1: F1 | F3; |
| 55 | + f2: F1 | F4; |
| 56 | + f3: F3 | F4; |
| 57 | + f4: F3 | F5; |
| 58 | + } |
| 59 | + x1.f0(); |
| 60 | + x1.f1(); |
| 61 | + x1.f2(); |
| 62 | + x1.f3(); // error |
| 63 | + ~~ |
| 64 | +!!! error TS2349: This expression is not callable. |
| 65 | +!!! error TS2349: Each member of the union type 'F3 | F4' has signatures, but none of those signatures are compatible with each other. |
| 66 | + x1.f4(); // error |
| 67 | + ~~ |
| 68 | +!!! 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'. |
| 69 | +!!! 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'. |
| 70 | +!!! related TS2728 tests/cases/conformance/types/union/unionTypeCallSignatures6.ts:2:12: 'b' is declared here. |
| 71 | + |
| 72 | + declare var x2: A & B & { |
| 73 | + f4: F3 | F5; |
| 74 | + } |
| 75 | + x2.f4(); |
| 76 | + |
| 77 | + type F6 = (this: A & B) => void; |
| 78 | + declare var f3: F1 | F6; |
| 79 | + f3(); // error |
| 80 | + ~~~~ |
| 81 | +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. |
| 82 | +!!! error TS2684: Type 'void' is not assignable to type 'A'. |
| 83 | + |
| 84 | + interface F7 { |
| 85 | + (this: A & B & C): void; |
| 86 | + (this: A & B): void; |
| 87 | + } |
| 88 | + declare var f4: F6 | F7; |
| 89 | + f4(); // error |
| 90 | + ~~~~ |
| 91 | +!!! error TS2769: No overload matches this call. |
| 92 | +!!! error TS2769: Overload 1 of 2, '(this: A & B & C): void', gave the following error. |
| 93 | +!!! error TS2769: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B & C'. |
| 94 | +!!! error TS2769: Type 'void' is not assignable to type 'A'. |
| 95 | +!!! error TS2769: Overload 2 of 2, '(this: A & B): void', gave the following error. |
| 96 | +!!! error TS2769: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. |
| 97 | +!!! error TS2769: Type 'void' is not assignable to type 'A'. |
| 98 | + |
0 commit comments