|
| 1 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(19,1): error TS2322: Type 'A' is not assignable to type 'A & B'. |
| 2 | + Type 'A' is not assignable to type 'B'. |
| 3 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(20,1): error TS2322: Type 'B' is not assignable to type 'A & B'. |
| 4 | + Type 'B' is not assignable to type 'A'. |
| 5 | + Property 'a' is missing in type 'B'. |
| 6 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(23,1): error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. |
| 7 | + Type 'A' is not assignable to type '(A & B) | (C & D)'. |
| 8 | + Type 'A' is not assignable to type 'C & D'. |
| 9 | + Type 'A' is not assignable to type 'C'. |
| 10 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'. |
| 11 | + Type 'C' is not assignable to type '(A & B) | (C & D)'. |
| 12 | + Type 'C' is not assignable to type 'C & D'. |
| 13 | + Type 'C' is not assignable to type 'D'. |
| 14 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(26,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'. |
| 15 | + Type 'C & D' is not assignable to type 'A & B'. |
| 16 | + Type 'C & D' is not assignable to type 'A'. |
| 17 | + Type 'D' is not assignable to type 'A'. |
| 18 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(27,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'. |
| 19 | + Type 'C & D' is not assignable to type 'A | B'. |
| 20 | + Type 'C & D' is not assignable to type 'B'. |
| 21 | + Type 'D' is not assignable to type 'B'. |
| 22 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(28,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'. |
| 23 | + Type 'A & B' is not assignable to type 'C & D'. |
| 24 | + Type 'A & B' is not assignable to type 'C'. |
| 25 | + Type 'B' is not assignable to type 'C'. |
| 26 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(29,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'. |
| 27 | + Type 'A & B' is not assignable to type 'C | D'. |
| 28 | + Type 'A & B' is not assignable to type 'D'. |
| 29 | + Type 'B' is not assignable to type 'D'. |
| 30 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(31,1): error TS2322: Type 'A & B' is not assignable to type '(A | B) & (C | D)'. |
| 31 | + Type 'A & B' is not assignable to type 'C | D'. |
| 32 | + Type 'A & B' is not assignable to type 'D'. |
| 33 | + Type 'B' is not assignable to type 'D'. |
| 34 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(32,1): error TS2322: Type 'A | B' is not assignable to type '(A | B) & (C | D)'. |
| 35 | + Type 'A' is not assignable to type '(A | B) & (C | D)'. |
| 36 | + Type 'A' is not assignable to type 'C | D'. |
| 37 | + Type 'A' is not assignable to type 'D'. |
| 38 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(33,1): error TS2322: Type 'C & D' is not assignable to type '(A | B) & (C | D)'. |
| 39 | + Type 'C & D' is not assignable to type 'A | B'. |
| 40 | + Type 'C & D' is not assignable to type 'B'. |
| 41 | + Type 'D' is not assignable to type 'B'. |
| 42 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(34,1): error TS2322: Type 'C | D' is not assignable to type '(A | B) & (C | D)'. |
| 43 | + Type 'C' is not assignable to type '(A | B) & (C | D)'. |
| 44 | + Type 'C' is not assignable to type 'A | B'. |
| 45 | + Type 'C' is not assignable to type 'B'. |
| 46 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(35,1): error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A & B'. |
| 47 | + Type '(A | B) & (C | D)' is not assignable to type 'A'. |
| 48 | + Type 'C | D' is not assignable to type 'A'. |
| 49 | + Type 'C' is not assignable to type 'A'. |
| 50 | +tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C & D'. |
| 51 | + Type '(A | B) & (C | D)' is not assignable to type 'C'. |
| 52 | + Type 'C | D' is not assignable to type 'C'. |
| 53 | + Type 'D' is not assignable to type 'C'. |
| 54 | + |
| 55 | + |
| 56 | +==== tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts (14 errors) ==== |
| 57 | + interface A { a: string } |
| 58 | + interface B { b: string } |
| 59 | + interface C { c: string } |
| 60 | + interface D { d: string } |
| 61 | + |
| 62 | + var a: A; |
| 63 | + var b: B; |
| 64 | + var c: C; |
| 65 | + var d: D; |
| 66 | + var anb: A & B; |
| 67 | + var aob: A | B; |
| 68 | + var cnd: C & D; |
| 69 | + var cod: C | D; |
| 70 | + var x: A & B | C & D; |
| 71 | + var y: (A | B) & (C | D); |
| 72 | + |
| 73 | + a = anb; // Ok |
| 74 | + b = anb; // Ok |
| 75 | + anb = a; |
| 76 | + ~~~ |
| 77 | +!!! error TS2322: Type 'A' is not assignable to type 'A & B'. |
| 78 | +!!! error TS2322: Type 'A' is not assignable to type 'B'. |
| 79 | + anb = b; |
| 80 | + ~~~ |
| 81 | +!!! error TS2322: Type 'B' is not assignable to type 'A & B'. |
| 82 | +!!! error TS2322: Type 'B' is not assignable to type 'A'. |
| 83 | +!!! error TS2322: Property 'a' is missing in type 'B'. |
| 84 | + |
| 85 | + x = anb; // Ok |
| 86 | + x = aob; |
| 87 | + ~ |
| 88 | +!!! error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. |
| 89 | +!!! error TS2322: Type 'A' is not assignable to type '(A & B) | (C & D)'. |
| 90 | +!!! error TS2322: Type 'A' is not assignable to type 'C & D'. |
| 91 | +!!! error TS2322: Type 'A' is not assignable to type 'C'. |
| 92 | + x = cnd; // Ok |
| 93 | + x = cod; |
| 94 | + ~ |
| 95 | +!!! error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'. |
| 96 | +!!! error TS2322: Type 'C' is not assignable to type '(A & B) | (C & D)'. |
| 97 | +!!! error TS2322: Type 'C' is not assignable to type 'C & D'. |
| 98 | +!!! error TS2322: Type 'C' is not assignable to type 'D'. |
| 99 | + anb = x; |
| 100 | + ~~~ |
| 101 | +!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'. |
| 102 | +!!! error TS2322: Type 'C & D' is not assignable to type 'A & B'. |
| 103 | +!!! error TS2322: Type 'C & D' is not assignable to type 'A'. |
| 104 | +!!! error TS2322: Type 'D' is not assignable to type 'A'. |
| 105 | + aob = x; |
| 106 | + ~~~ |
| 107 | +!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'. |
| 108 | +!!! error TS2322: Type 'C & D' is not assignable to type 'A | B'. |
| 109 | +!!! error TS2322: Type 'C & D' is not assignable to type 'B'. |
| 110 | +!!! error TS2322: Type 'D' is not assignable to type 'B'. |
| 111 | + cnd = x; |
| 112 | + ~~~ |
| 113 | +!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'. |
| 114 | +!!! error TS2322: Type 'A & B' is not assignable to type 'C & D'. |
| 115 | +!!! error TS2322: Type 'A & B' is not assignable to type 'C'. |
| 116 | +!!! error TS2322: Type 'B' is not assignable to type 'C'. |
| 117 | + cod = x; |
| 118 | + ~~~ |
| 119 | +!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'. |
| 120 | +!!! error TS2322: Type 'A & B' is not assignable to type 'C | D'. |
| 121 | +!!! error TS2322: Type 'A & B' is not assignable to type 'D'. |
| 122 | +!!! error TS2322: Type 'B' is not assignable to type 'D'. |
| 123 | + |
| 124 | + y = anb; |
| 125 | + ~ |
| 126 | +!!! error TS2322: Type 'A & B' is not assignable to type '(A | B) & (C | D)'. |
| 127 | +!!! error TS2322: Type 'A & B' is not assignable to type 'C | D'. |
| 128 | +!!! error TS2322: Type 'A & B' is not assignable to type 'D'. |
| 129 | +!!! error TS2322: Type 'B' is not assignable to type 'D'. |
| 130 | + y = aob; |
| 131 | + ~ |
| 132 | +!!! error TS2322: Type 'A | B' is not assignable to type '(A | B) & (C | D)'. |
| 133 | +!!! error TS2322: Type 'A' is not assignable to type '(A | B) & (C | D)'. |
| 134 | +!!! error TS2322: Type 'A' is not assignable to type 'C | D'. |
| 135 | +!!! error TS2322: Type 'A' is not assignable to type 'D'. |
| 136 | + y = cnd; |
| 137 | + ~ |
| 138 | +!!! error TS2322: Type 'C & D' is not assignable to type '(A | B) & (C | D)'. |
| 139 | +!!! error TS2322: Type 'C & D' is not assignable to type 'A | B'. |
| 140 | +!!! error TS2322: Type 'C & D' is not assignable to type 'B'. |
| 141 | +!!! error TS2322: Type 'D' is not assignable to type 'B'. |
| 142 | + y = cod; |
| 143 | + ~ |
| 144 | +!!! error TS2322: Type 'C | D' is not assignable to type '(A | B) & (C | D)'. |
| 145 | +!!! error TS2322: Type 'C' is not assignable to type '(A | B) & (C | D)'. |
| 146 | +!!! error TS2322: Type 'C' is not assignable to type 'A | B'. |
| 147 | +!!! error TS2322: Type 'C' is not assignable to type 'B'. |
| 148 | + anb = y; |
| 149 | + ~~~ |
| 150 | +!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A & B'. |
| 151 | +!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A'. |
| 152 | +!!! error TS2322: Type 'C | D' is not assignable to type 'A'. |
| 153 | +!!! error TS2322: Type 'C' is not assignable to type 'A'. |
| 154 | + aob = y; // Ok |
| 155 | + cnd = y; |
| 156 | + ~~~ |
| 157 | +!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C & D'. |
| 158 | +!!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C'. |
| 159 | +!!! error TS2322: Type 'C | D' is not assignable to type 'C'. |
| 160 | +!!! error TS2322: Type 'D' is not assignable to type 'C'. |
| 161 | + cod = y; // Ok |
| 162 | + |
0 commit comments