@@ -14,9 +14,17 @@ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(38,11): error TS2322
1414tests/cases/conformance/types/spread/objectSpreadGeneric.ts(42,11): error TS2322: Type '{ firrrrrrst: string; ...T; second: string; ...U; third: string; }' is not assignable to type '{ first: string; ...T; second: string; ...U; third: string; }'.
1515tests/cases/conformance/types/spread/objectSpreadGeneric.ts(44,11): error TS2322: Type '{ first: string; ...T; ssssssssecond: string; ...U; third: string; }' is not assignable to type '{ first: string; ...T; second: string; ...U; third: string; }'.
1616tests/cases/conformance/types/spread/objectSpreadGeneric.ts(46,11): error TS2322: Type '{ first: string; ...T; second: string; ...U; thirrrrrrrd: string; }' is not assignable to type '{ first: string; ...T; second: string; ...U; third: string; }'.
17+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(57,5): error TS2322: Type '{ ...keyof U }' is not assignable to type '{ ...keyof T }'.
18+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(58,5): error TS2322: Type '{ ...keyof T }' is not assignable to type '{ ...keyof U }'.
19+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(61,5): error TS2322: Type '{ ...K }' is not assignable to type '{ ...keyof T }'.
20+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(62,5): error TS2322: Type '{ ...keyof T }' is not assignable to type '{ ...K }'.
21+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(63,5): error TS2322: Type '{ ...J }' is not assignable to type '{ ...keyof U }'.
22+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(64,5): error TS2322: Type '{ ...keyof U }' is not assignable to type '{ ...J }'.
23+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(70,5): error TS2322: Type '{ ...U[J] }' is not assignable to type '{ ...T[K] }'.
24+ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(71,5): error TS2322: Type '{ ...T[K] }' is not assignable to type '{ ...U[J] }'.
1725
1826
19- ==== tests/cases/conformance/types/spread/objectSpreadGeneric.ts (16 errors) ====
27+ ==== tests/cases/conformance/types/spread/objectSpreadGeneric.ts (24 errors) ====
2028 function f<T, U, V>(t: T, u: U, v: V): void {
2129 let o: { ...T, ...U, ...V };
2230 let uus: { ...U, ...U};
@@ -97,4 +105,44 @@ tests/cases/conformance/types/spread/objectSpreadGeneric.ts(46,11): error TS2322
97105!!! error TS2322: Type '{ first: string; ...T; second: string; ...U; thirrrrrrrd: string; }' is not assignable to type '{ first: string; ...T; second: string; ...U; third: string; }'.
98106 { first: '1', ...t, second: '2', ...u, thirrrrrrrd: '3' }; // error, not assignable
99107 }
108+
109+ function indexAccessedTest<T, K extends keyof T, U, J extends keyof U>(t: T, u: U, key1: K, key2: J) {
110+ let k1: { ...keyof T };
111+ let k2: { ...keyof U };
112+ let k3: { ...K };
113+ let k4: { ...J };
114+ k1 = k1; // ok
115+ k2 = k2; // ok
116+ k1 = k2; // error
117+ ~~
118+ !!! error TS2322: Type '{ ...keyof U }' is not assignable to type '{ ...keyof T }'.
119+ k2 = k1; // error
120+ ~~
121+ !!! error TS2322: Type '{ ...keyof T }' is not assignable to type '{ ...keyof U }'.
122+ k3 = k3; // ok
123+ k4 = k4; // ok
124+ k1 = k3; // error
125+ ~~
126+ !!! error TS2322: Type '{ ...K }' is not assignable to type '{ ...keyof T }'.
127+ k3 = k1; // error
128+ ~~
129+ !!! error TS2322: Type '{ ...keyof T }' is not assignable to type '{ ...K }'.
130+ k2 = k4; // error
131+ ~~
132+ !!! error TS2322: Type '{ ...J }' is not assignable to type '{ ...keyof U }'.
133+ k4 = k2; // error
134+ ~~
135+ !!! error TS2322: Type '{ ...keyof U }' is not assignable to type '{ ...J }'.
136+
137+ let i1: { ...T[K] };
138+ let i2: { ...U[J] };
139+ i1 = i1; // ok
140+ i2 = i2; // ok
141+ i1 = i2; // error
142+ ~~
143+ !!! error TS2322: Type '{ ...U[J] }' is not assignable to type '{ ...T[K] }'.
144+ i2 = i1; // error
145+ ~~
146+ !!! error TS2322: Type '{ ...T[K] }' is not assignable to type '{ ...U[J] }'.
147+ }
100148
0 commit comments