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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(19,1): error TS2322: Type 'A' is not assignable to type 'A & B'.
Type 'A' is not assignable to type 'B'.
Property 'b' is missing in type 'A'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(20,1): error TS2322: Type 'B' is not assignable to type 'A & B'.
Type 'B' is not assignable to type 'A'.
Property 'a' is missing in type 'B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(23,1): error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'.
Type 'A' is not assignable to type '(A & B) | (C & D)'.
Type 'A' is not assignable to type 'C & D'.
Type 'A' is not assignable to type 'C'.
Property 'c' is missing in type 'A'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'.
Type 'C' is not assignable to type '(A & B) | (C & D)'.
Type 'C' is not assignable to type 'C & D'.
Type 'C' is not assignable to type 'D'.
Property 'd' is missing in type 'C'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(26,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'.
Type 'C & D' is not assignable to type 'A & B'.
Type 'C & D' is not assignable to type 'A'.
Property 'a' is missing in type 'C & D'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(27,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'.
Type 'C & D' is not assignable to type 'A | B'.
Type 'C & D' is not assignable to type 'B'.
Property 'b' is missing in type 'C & D'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(28,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'.
Type 'A & B' is not assignable to type 'C & D'.
Type 'A & B' is not assignable to type 'C'.
Property 'c' is missing in type 'A & B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(29,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'.
Type 'A & B' is not assignable to type 'C | D'.
Type 'A & B' is not assignable to type 'D'.
Property 'd' is missing in type 'A & B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(31,1): error TS2322: Type 'A & B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'A & B' is not assignable to type 'B & D'.
Type 'A & B' is not assignable to type 'D'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(32,1): error TS2322: Type 'A | B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'A' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'A' is not assignable to type 'B & D'.
Type 'A' is not assignable to type 'B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(33,1): error TS2322: Type 'C & D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'C & D' is not assignable to type 'B & D'.
Type 'C & D' is not assignable to type 'B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(34,1): error TS2322: Type 'C | D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'C' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'C' is not assignable to type 'B & D'.
Type 'C' is not assignable to type 'B'.
Property 'b' is missing in type 'C'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(35,1): error TS2322: Type '(A & C) | (A & D) | (B & C) | (B & D)' is not assignable to type 'A & B'.
Type 'A & C' is not assignable to type 'A & B'.
Type 'A & C' is not assignable to type 'B'.
Property 'b' is missing in type 'A & C'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): error TS2322: Type '(A & C) | (A & D) | (B & C) | (B & D)' is not assignable to type 'C & D'.
Type 'A & C' is not assignable to type 'C & D'.
Type 'A & C' is not assignable to type 'D'.
Property 'd' is missing in type 'A & C'.
==== tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts (14 errors) ====
interface A { a: string }
interface B { b: string }
interface C { c: string }
interface D { d: string }
var a: A;
var b: B;
var c: C;
var d: D;
var anb: A & B;
var aob: A | B;
var cnd: C & D;
var cod: C | D;
var x: A & B | C & D;
var y: (A | B) & (C | D);
a = anb; // Ok
b = anb; // Ok
anb = a;
~~~
!!! error TS2322: Type 'A' is not assignable to type 'A & B'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: Property 'b' is missing in type 'A'.
anb = b;
~~~
!!! error TS2322: Type 'B' is not assignable to type 'A & B'.
!!! error TS2322: Type 'B' is not assignable to type 'A'.
!!! error TS2322: Property 'a' is missing in type 'B'.
x = anb; // Ok
x = aob;
~
!!! error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'.
!!! error TS2322: Type 'A' is not assignable to type '(A & B) | (C & D)'.
!!! error TS2322: Type 'A' is not assignable to type 'C & D'.
!!! error TS2322: Type 'A' is not assignable to type 'C'.
!!! error TS2322: Property 'c' is missing in type 'A'.
x = cnd; // Ok
x = cod;
~
!!! error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'.
!!! error TS2322: Type 'C' is not assignable to type '(A & B) | (C & D)'.
!!! error TS2322: Type 'C' is not assignable to type 'C & D'.
!!! error TS2322: Type 'C' is not assignable to type 'D'.
!!! error TS2322: Property 'd' is missing in type 'C'.
anb = x;
~~~
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'.
!!! error TS2322: Type 'C & D' is not assignable to type 'A & B'.
!!! error TS2322: Type 'C & D' is not assignable to type 'A'.
!!! error TS2322: Property 'a' is missing in type 'C & D'.
aob = x;
~~~
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'.
!!! error TS2322: Type 'C & D' is not assignable to type 'A | B'.
!!! error TS2322: Type 'C & D' is not assignable to type 'B'.
!!! error TS2322: Property 'b' is missing in type 'C & D'.
cnd = x;
~~~
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'.
!!! error TS2322: Type 'A & B' is not assignable to type 'C & D'.
!!! error TS2322: Type 'A & B' is not assignable to type 'C'.
!!! error TS2322: Property 'c' is missing in type 'A & B'.
cod = x;
~~~
!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'.
!!! error TS2322: Type 'A & B' is not assignable to type 'C | D'.
!!! error TS2322: Type 'A & B' is not assignable to type 'D'.
!!! error TS2322: Property 'd' is missing in type 'A & B'.
y = anb;
~
!!! error TS2322: Type 'A & B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'A & B' is not assignable to type 'B & D'.
!!! error TS2322: Type 'A & B' is not assignable to type 'D'.
y = aob;
~
!!! error TS2322: Type 'A | B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'A' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'A' is not assignable to type 'B & D'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
y = cnd;
~
!!! error TS2322: Type 'C & D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'C & D' is not assignable to type 'B & D'.
!!! error TS2322: Type 'C & D' is not assignable to type 'B'.
y = cod;
~
!!! error TS2322: Type 'C | D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'C' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'C' is not assignable to type 'B & D'.
!!! error TS2322: Type 'C' is not assignable to type 'B'.
!!! error TS2322: Property 'b' is missing in type 'C'.
anb = y;
~~~
!!! error TS2322: Type '(A & C) | (A & D) | (B & C) | (B & D)' is not assignable to type 'A & B'.
!!! error TS2322: Type 'A & C' is not assignable to type 'A & B'.
!!! error TS2322: Type 'A & C' is not assignable to type 'B'.
!!! error TS2322: Property 'b' is missing in type 'A & C'.
aob = y; // Ok
cnd = y;
~~~
!!! error TS2322: Type '(A & C) | (A & D) | (B & C) | (B & D)' is not assignable to type 'C & D'.
!!! error TS2322: Type 'A & C' is not assignable to type 'C & D'.
!!! error TS2322: Type 'A & C' is not assignable to type 'D'.
!!! error TS2322: Property 'd' is missing in type 'A & C'.
cod = y; // Ok
|