mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Update spread w/intersection tests
This commit is contained in:
parent
76d194440c
commit
d9afa34be1
@ -3,7 +3,6 @@ function iteratedUnionIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tu: T | U;
|
||||
let uv: U & V;
|
||||
let result = { ...tu, ...uv, id: 'foo' };
|
||||
let expected: ({ ...T, ...U, id: string } & { ...T, ...V, id: string }) | ({ ...U, id: string } & { ...U, ...V, id: string });
|
||||
let assignable: { ...(T | U), ...(U & V), id: string } = result;
|
||||
}
|
||||
// concrete types work
|
||||
@ -17,21 +16,18 @@ let assignable: { ...(A1 & A2) } = result;
|
||||
function tripleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tuv: T & U & V;
|
||||
let result = { ...tuv, id: 'bar' };
|
||||
let expected: { ...T, id: string } & { ...U, id: string } & { ...V, id: string } = result;
|
||||
let assignable: { ...(T & U & V), id: string } = result;
|
||||
}
|
||||
function iteratedDoubleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tu: T & U;
|
||||
let uv: U & V;
|
||||
let result = { ...tu, ...uv, id: 'baz' };
|
||||
let expected: { ...T, ...U, id: string } & { ...T, ...V, id: string } & { ...U, id: string } & { ...U, ...V, id: string };
|
||||
let assignable: { ...(T & U), ...(U & V), id: string } = result;
|
||||
}
|
||||
function iteratedIntersectionUnion<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tu: T & U;
|
||||
let uv: U | V;
|
||||
let result = { ...tu, ...uv, id: 'qux' };
|
||||
let expected: ({ ...T, ...U, id: string } & { ...U, id: string }) | ({ ...T, ...V, id: string } & { ...U, ...V, id: string });
|
||||
let assignable: { ...(T & U), ...(U | V), id: string } = result;
|
||||
}
|
||||
|
||||
@ -50,7 +46,6 @@ function iteratedUnionIntersection(t, u, v) {
|
||||
var tu;
|
||||
var uv;
|
||||
var result = __assign({}, tu, uv, { id: 'foo' });
|
||||
var expected;
|
||||
var assignable = result;
|
||||
}
|
||||
var a12;
|
||||
@ -60,20 +55,17 @@ var assignable = result;
|
||||
function tripleIntersection(t, u, v) {
|
||||
var tuv;
|
||||
var result = __assign({}, tuv, { id: 'bar' });
|
||||
var expected = result;
|
||||
var assignable = result;
|
||||
}
|
||||
function iteratedDoubleIntersection(t, u, v) {
|
||||
var tu;
|
||||
var uv;
|
||||
var result = __assign({}, tu, uv, { id: 'baz' });
|
||||
var expected;
|
||||
var assignable = result;
|
||||
}
|
||||
function iteratedIntersectionUnion(t, u, v) {
|
||||
var tu;
|
||||
var uv;
|
||||
var result = __assign({}, tu, uv, { id: 'qux' });
|
||||
var expected;
|
||||
var assignable = result;
|
||||
}
|
||||
|
||||
@ -25,195 +25,143 @@ function iteratedUnionIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 3, 7))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 3, 32))
|
||||
|
||||
let expected: ({ ...T, ...U, id: string } & { ...T, ...V, id: string }) | ({ ...U, id: string } & { ...U, ...V, id: string });
|
||||
>expected : Symbol(expected, Decl(objectSpreadIntersection.ts, 4, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 0, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 0, 37))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 4, 32))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 0, 35))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 0, 40))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 4, 61))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 0, 37))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 4, 86))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 0, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 0, 40))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 4, 115))
|
||||
|
||||
let assignable: { ...(T | U), ...(U & V), id: string } = result;
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 5, 7))
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 4, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 0, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 0, 37))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 0, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 0, 40))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 5, 45))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 4, 45))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 3, 7))
|
||||
}
|
||||
// concrete types work
|
||||
interface A1 { a: number }
|
||||
>A1 : Symbol(A1, Decl(objectSpreadIntersection.ts, 6, 1))
|
||||
>a : Symbol(A1.a, Decl(objectSpreadIntersection.ts, 8, 14))
|
||||
>A1 : Symbol(A1, Decl(objectSpreadIntersection.ts, 5, 1))
|
||||
>a : Symbol(A1.a, Decl(objectSpreadIntersection.ts, 7, 14))
|
||||
|
||||
interface A2 { a: string }
|
||||
>A2 : Symbol(A2, Decl(objectSpreadIntersection.ts, 8, 26))
|
||||
>a : Symbol(A2.a, Decl(objectSpreadIntersection.ts, 9, 14))
|
||||
>A2 : Symbol(A2, Decl(objectSpreadIntersection.ts, 7, 26))
|
||||
>a : Symbol(A2.a, Decl(objectSpreadIntersection.ts, 8, 14))
|
||||
|
||||
let a12: A1 & A2;
|
||||
>a12 : Symbol(a12, Decl(objectSpreadIntersection.ts, 10, 3))
|
||||
>A1 : Symbol(A1, Decl(objectSpreadIntersection.ts, 6, 1))
|
||||
>A2 : Symbol(A2, Decl(objectSpreadIntersection.ts, 8, 26))
|
||||
>a12 : Symbol(a12, Decl(objectSpreadIntersection.ts, 9, 3))
|
||||
>A1 : Symbol(A1, Decl(objectSpreadIntersection.ts, 5, 1))
|
||||
>A2 : Symbol(A2, Decl(objectSpreadIntersection.ts, 7, 26))
|
||||
|
||||
let result = { ...a12 };
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 11, 3))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 10, 3))
|
||||
|
||||
let sn: number & string = result.a;
|
||||
>sn : Symbol(sn, Decl(objectSpreadIntersection.ts, 12, 3))
|
||||
>result.a : Symbol(a, Decl(objectSpreadIntersection.ts, 8, 14), Decl(objectSpreadIntersection.ts, 9, 14))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 11, 3))
|
||||
>a : Symbol(a, Decl(objectSpreadIntersection.ts, 8, 14), Decl(objectSpreadIntersection.ts, 9, 14))
|
||||
>sn : Symbol(sn, Decl(objectSpreadIntersection.ts, 11, 3))
|
||||
>result.a : Symbol(a, Decl(objectSpreadIntersection.ts, 7, 14), Decl(objectSpreadIntersection.ts, 8, 14))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 10, 3))
|
||||
>a : Symbol(a, Decl(objectSpreadIntersection.ts, 7, 14), Decl(objectSpreadIntersection.ts, 8, 14))
|
||||
|
||||
let assignable: { ...(A1 & A2) } = result;
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 13, 3))
|
||||
>A1 : Symbol(A1, Decl(objectSpreadIntersection.ts, 6, 1))
|
||||
>A2 : Symbol(A2, Decl(objectSpreadIntersection.ts, 8, 26))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 11, 3))
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 12, 3))
|
||||
>A1 : Symbol(A1, Decl(objectSpreadIntersection.ts, 5, 1))
|
||||
>A2 : Symbol(A2, Decl(objectSpreadIntersection.ts, 7, 26))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 10, 3))
|
||||
|
||||
function tripleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>tripleIntersection : Symbol(tripleIntersection, Decl(objectSpreadIntersection.ts, 13, 42))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 15, 28))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 15, 30))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 15, 33))
|
||||
>t : Symbol(t, Decl(objectSpreadIntersection.ts, 15, 37))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 15, 28))
|
||||
>u : Symbol(u, Decl(objectSpreadIntersection.ts, 15, 42))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 15, 30))
|
||||
>v : Symbol(v, Decl(objectSpreadIntersection.ts, 15, 48))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 15, 33))
|
||||
>tripleIntersection : Symbol(tripleIntersection, Decl(objectSpreadIntersection.ts, 12, 42))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 14, 28))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 14, 30))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 14, 33))
|
||||
>t : Symbol(t, Decl(objectSpreadIntersection.ts, 14, 37))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 14, 28))
|
||||
>u : Symbol(u, Decl(objectSpreadIntersection.ts, 14, 42))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 14, 30))
|
||||
>v : Symbol(v, Decl(objectSpreadIntersection.ts, 14, 48))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 14, 33))
|
||||
|
||||
let tuv: T & U & V;
|
||||
>tuv : Symbol(tuv, Decl(objectSpreadIntersection.ts, 16, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 15, 28))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 15, 30))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 15, 33))
|
||||
>tuv : Symbol(tuv, Decl(objectSpreadIntersection.ts, 15, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 14, 28))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 14, 30))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 14, 33))
|
||||
|
||||
let result = { ...tuv, id: 'bar' };
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 17, 7))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 17, 26))
|
||||
|
||||
let expected: { ...T, id: string } & { ...U, id: string } & { ...V, id: string } = result;
|
||||
>expected : Symbol(expected, Decl(objectSpreadIntersection.ts, 18, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 15, 28))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 18, 25))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 15, 30))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 18, 48))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 15, 33))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 18, 71))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 17, 7))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 16, 7))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 16, 26))
|
||||
|
||||
let assignable: { ...(T & U & V), id: string } = result;
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 19, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 15, 28))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 15, 30))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 15, 33))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 19, 37))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 17, 7))
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 17, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 14, 28))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 14, 30))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 14, 33))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 17, 37))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 16, 7))
|
||||
}
|
||||
function iteratedDoubleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>iteratedDoubleIntersection : Symbol(iteratedDoubleIntersection, Decl(objectSpreadIntersection.ts, 20, 1))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 21, 36))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 21, 41))
|
||||
>t : Symbol(t, Decl(objectSpreadIntersection.ts, 21, 45))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 21, 36))
|
||||
>u : Symbol(u, Decl(objectSpreadIntersection.ts, 21, 50))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>v : Symbol(v, Decl(objectSpreadIntersection.ts, 21, 56))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 21, 41))
|
||||
>iteratedDoubleIntersection : Symbol(iteratedDoubleIntersection, Decl(objectSpreadIntersection.ts, 18, 1))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 19, 36))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 19, 38))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 19, 41))
|
||||
>t : Symbol(t, Decl(objectSpreadIntersection.ts, 19, 45))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 19, 36))
|
||||
>u : Symbol(u, Decl(objectSpreadIntersection.ts, 19, 50))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 19, 38))
|
||||
>v : Symbol(v, Decl(objectSpreadIntersection.ts, 19, 56))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 19, 41))
|
||||
|
||||
let tu: T & U;
|
||||
>tu : Symbol(tu, Decl(objectSpreadIntersection.ts, 22, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 21, 36))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>tu : Symbol(tu, Decl(objectSpreadIntersection.ts, 20, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 19, 36))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 19, 38))
|
||||
|
||||
let uv: U & V;
|
||||
>uv : Symbol(uv, Decl(objectSpreadIntersection.ts, 23, 7))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 21, 41))
|
||||
>uv : Symbol(uv, Decl(objectSpreadIntersection.ts, 21, 7))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 19, 38))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 19, 41))
|
||||
|
||||
let result = { ...tu, ...uv, id: 'baz' };
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 24, 7))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 24, 32))
|
||||
|
||||
let expected: { ...T, ...U, id: string } & { ...T, ...V, id: string } & { ...U, id: string } & { ...U, ...V, id: string };
|
||||
>expected : Symbol(expected, Decl(objectSpreadIntersection.ts, 25, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 21, 36))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 25, 31))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 21, 36))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 21, 41))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 25, 60))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 25, 83))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 21, 41))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 25, 112))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 22, 7))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 22, 32))
|
||||
|
||||
let assignable: { ...(T & U), ...(U & V), id: string } = result;
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 26, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 21, 36))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 21, 38))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 21, 41))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 26, 45))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 24, 7))
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 23, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 19, 36))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 19, 38))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 19, 38))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 19, 41))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 23, 45))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 22, 7))
|
||||
}
|
||||
function iteratedIntersectionUnion<T, U, V>(t: T, u: U, v: V): void {
|
||||
>iteratedIntersectionUnion : Symbol(iteratedIntersectionUnion, Decl(objectSpreadIntersection.ts, 27, 1))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 28, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 28, 40))
|
||||
>t : Symbol(t, Decl(objectSpreadIntersection.ts, 28, 44))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 28, 35))
|
||||
>u : Symbol(u, Decl(objectSpreadIntersection.ts, 28, 49))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>v : Symbol(v, Decl(objectSpreadIntersection.ts, 28, 55))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 28, 40))
|
||||
>iteratedIntersectionUnion : Symbol(iteratedIntersectionUnion, Decl(objectSpreadIntersection.ts, 24, 1))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 25, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 25, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 25, 40))
|
||||
>t : Symbol(t, Decl(objectSpreadIntersection.ts, 25, 44))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 25, 35))
|
||||
>u : Symbol(u, Decl(objectSpreadIntersection.ts, 25, 49))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 25, 37))
|
||||
>v : Symbol(v, Decl(objectSpreadIntersection.ts, 25, 55))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 25, 40))
|
||||
|
||||
let tu: T & U;
|
||||
>tu : Symbol(tu, Decl(objectSpreadIntersection.ts, 29, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 28, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>tu : Symbol(tu, Decl(objectSpreadIntersection.ts, 26, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 25, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 25, 37))
|
||||
|
||||
let uv: U | V;
|
||||
>uv : Symbol(uv, Decl(objectSpreadIntersection.ts, 30, 7))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 28, 40))
|
||||
>uv : Symbol(uv, Decl(objectSpreadIntersection.ts, 27, 7))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 25, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 25, 40))
|
||||
|
||||
let result = { ...tu, ...uv, id: 'qux' };
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 31, 7))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 31, 32))
|
||||
|
||||
let expected: ({ ...T, ...U, id: string } & { ...U, id: string }) | ({ ...T, ...V, id: string } & { ...U, ...V, id: string });
|
||||
>expected : Symbol(expected, Decl(objectSpreadIntersection.ts, 32, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 28, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 32, 32))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 32, 55))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 28, 35))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 28, 40))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 32, 86))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 28, 40))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 32, 115))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 28, 7))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 28, 32))
|
||||
|
||||
let assignable: { ...(T & U), ...(U | V), id: string } = result;
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 33, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 28, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 28, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 28, 40))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 33, 45))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 31, 7))
|
||||
>assignable : Symbol(assignable, Decl(objectSpreadIntersection.ts, 29, 7))
|
||||
>T : Symbol(T, Decl(objectSpreadIntersection.ts, 25, 35))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 25, 37))
|
||||
>U : Symbol(U, Decl(objectSpreadIntersection.ts, 25, 37))
|
||||
>V : Symbol(V, Decl(objectSpreadIntersection.ts, 25, 40))
|
||||
>id : Symbol(id, Decl(objectSpreadIntersection.ts, 29, 45))
|
||||
>result : Symbol(result, Decl(objectSpreadIntersection.ts, 28, 7))
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,35 +22,21 @@ function iteratedUnionIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>V : V
|
||||
|
||||
let result = { ...tu, ...uv, id: 'foo' };
|
||||
>result : ({ ...U; id: string; } | { ...T; ...U; id: string; } | { ...U; ...T; ...U; id: string; } | { ...T; ...U; ...T; ...U; id: string; }) & ({ ...T; ...V; id: string; } | { ...U; ...T; ...V; id: string; } | { ...U; ...V; id: string; } | { ...T; ...U; ...V; id: string; } | { ...T; ...U; ...T; ...V; id: string; } | { ...U; ...T; ...U; ...V; id: string; })
|
||||
>{ ...tu, ...uv, id: 'foo' } : ({ ...U; id: string; } | { ...T; ...U; id: string; } | { ...U; ...T; ...U; id: string; } | { ...T; ...U; ...T; ...U; id: string; }) & ({ ...T; ...V; id: string; } | { ...U; ...T; ...V; id: string; } | { ...U; ...V; id: string; } | { ...T; ...U; ...V; id: string; } | { ...T; ...U; ...T; ...V; id: string; } | { ...U; ...T; ...U; ...V; id: string; })
|
||||
>result : { ...T; ...U & V; id: string; } | { ...U; ...U & V; id: string; }
|
||||
>{ ...tu, ...uv, id: 'foo' } : { ...T; ...U & V; id: string; } | { ...U; ...U & V; id: string; }
|
||||
>tu : any
|
||||
>uv : any
|
||||
>id : string
|
||||
>'foo' : "foo"
|
||||
|
||||
let expected: ({ ...T, ...U, id: string } & { ...T, ...V, id: string }) | ({ ...U, id: string } & { ...U, ...V, id: string });
|
||||
>expected : ({ ...T; ...U; id: string; } & { ...T; ...V; id: string; }) | ({ ...U; id: string; } & { ...U; ...V; id: string; })
|
||||
>T : T
|
||||
>U : U
|
||||
>id : string
|
||||
>T : T
|
||||
>V : V
|
||||
>id : string
|
||||
>U : U
|
||||
>id : string
|
||||
>U : U
|
||||
>V : V
|
||||
>id : string
|
||||
|
||||
let assignable: { ...(T | U), ...(U & V), id: string } = result;
|
||||
>assignable : ({ ...U; id: string; } | { ...T; ...U; id: string; } | { ...U; ...T; ...U; id: string; } | { ...T; ...U; ...T; ...U; id: string; }) & ({ ...T; ...V; id: string; } | { ...U; ...T; ...V; id: string; } | { ...U; ...V; id: string; } | { ...T; ...U; ...V; id: string; } | { ...T; ...U; ...T; ...V; id: string; } | { ...U; ...T; ...U; ...V; id: string; })
|
||||
>assignable : { ...T; ...U & V; id: string; } | { ...U; ...U & V; id: string; }
|
||||
>T : T
|
||||
>U : U
|
||||
>U : U
|
||||
>V : V
|
||||
>id : string
|
||||
>result : ({ ...U; id: string; } | { ...T; ...U; id: string; } | { ...U; ...T; ...U; id: string; } | { ...T; ...U; ...T; ...U; id: string; }) & ({ ...T; ...V; id: string; } | { ...U; ...T; ...V; id: string; } | { ...U; ...V; id: string; } | { ...T; ...U; ...V; id: string; } | { ...T; ...U; ...T; ...V; id: string; } | { ...U; ...T; ...U; ...V; id: string; })
|
||||
>result : { ...T; ...U & V; id: string; } | { ...U; ...U & V; id: string; }
|
||||
}
|
||||
// concrete types work
|
||||
interface A1 { a: number }
|
||||
@ -67,21 +53,21 @@ let a12: A1 & A2;
|
||||
>A2 : A2
|
||||
|
||||
let result = { ...a12 };
|
||||
>result : { a: number; } & { a: string; }
|
||||
>{ ...a12 } : { a: number; } & { a: string; }
|
||||
>result : { ...A1 & A2 }
|
||||
>{ ...a12 } : { ...A1 & A2 }
|
||||
>a12 : any
|
||||
|
||||
let sn: number & string = result.a;
|
||||
>sn : number & string
|
||||
>result.a : number & string
|
||||
>result : { a: number; } & { a: string; }
|
||||
>result : { ...A1 & A2 }
|
||||
>a : number & string
|
||||
|
||||
let assignable: { ...(A1 & A2) } = result;
|
||||
>assignable : { a: number; } & { a: string; }
|
||||
>assignable : { ...A1 & A2 }
|
||||
>A1 : A1
|
||||
>A2 : A2
|
||||
>result : { a: number; } & { a: string; }
|
||||
>result : { ...A1 & A2 }
|
||||
|
||||
function tripleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>tripleIntersection : <T, U, V>(t: T, u: U, v: V) => void
|
||||
@ -102,29 +88,19 @@ function tripleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>V : V
|
||||
|
||||
let result = { ...tuv, id: 'bar' };
|
||||
>result : { ...T; id: string; } & { ...U; id: string; } & { ...V; id: string; }
|
||||
>{ ...tuv, id: 'bar' } : { ...T; id: string; } & { ...U; id: string; } & { ...V; id: string; }
|
||||
>result : { ...T & U & V; id: string; }
|
||||
>{ ...tuv, id: 'bar' } : { ...T & U & V; id: string; }
|
||||
>tuv : any
|
||||
>id : string
|
||||
>'bar' : "bar"
|
||||
|
||||
let expected: { ...T, id: string } & { ...U, id: string } & { ...V, id: string } = result;
|
||||
>expected : { ...T; id: string; } & { ...U; id: string; } & { ...V; id: string; }
|
||||
>T : T
|
||||
>id : string
|
||||
>U : U
|
||||
>id : string
|
||||
>V : V
|
||||
>id : string
|
||||
>result : { ...T; id: string; } & { ...U; id: string; } & { ...V; id: string; }
|
||||
|
||||
let assignable: { ...(T & U & V), id: string } = result;
|
||||
>assignable : { ...T; id: string; } & { ...U; id: string; } & { ...V; id: string; }
|
||||
>assignable : { ...T & U & V; id: string; }
|
||||
>T : T
|
||||
>U : U
|
||||
>V : V
|
||||
>id : string
|
||||
>result : { ...T; id: string; } & { ...U; id: string; } & { ...V; id: string; }
|
||||
>result : { ...T & U & V; id: string; }
|
||||
}
|
||||
function iteratedDoubleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>iteratedDoubleIntersection : <T, U, V>(t: T, u: U, v: V) => void
|
||||
@ -149,35 +125,21 @@ function iteratedDoubleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
>V : V
|
||||
|
||||
let result = { ...tu, ...uv, id: 'baz' };
|
||||
>result : { ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...U; id: string; } & { ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; }
|
||||
>{ ...tu, ...uv, id: 'baz' } : { ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...U; id: string; } & { ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; }
|
||||
>result : { ...T & U; ...U & V; id: string; }
|
||||
>{ ...tu, ...uv, id: 'baz' } : { ...T & U; ...U & V; id: string; }
|
||||
>tu : any
|
||||
>uv : any
|
||||
>id : string
|
||||
>'baz' : "baz"
|
||||
|
||||
let expected: { ...T, ...U, id: string } & { ...T, ...V, id: string } & { ...U, id: string } & { ...U, ...V, id: string };
|
||||
>expected : { ...T; ...U; id: string; } & { ...T; ...V; id: string; } & { ...U; id: string; } & { ...U; ...V; id: string; }
|
||||
>T : T
|
||||
>U : U
|
||||
>id : string
|
||||
>T : T
|
||||
>V : V
|
||||
>id : string
|
||||
>U : U
|
||||
>id : string
|
||||
>U : U
|
||||
>V : V
|
||||
>id : string
|
||||
|
||||
let assignable: { ...(T & U), ...(U & V), id: string } = result;
|
||||
>assignable : { ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...U; id: string; } & { ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; }
|
||||
>assignable : { ...T & U; ...U & V; id: string; }
|
||||
>T : T
|
||||
>U : U
|
||||
>U : U
|
||||
>V : V
|
||||
>id : string
|
||||
>result : { ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...U; id: string; } & { ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; }
|
||||
>result : { ...T & U; ...U & V; id: string; }
|
||||
}
|
||||
function iteratedIntersectionUnion<T, U, V>(t: T, u: U, v: V): void {
|
||||
>iteratedIntersectionUnion : <T, U, V>(t: T, u: U, v: V) => void
|
||||
@ -202,35 +164,21 @@ function iteratedIntersectionUnion<T, U, V>(t: T, u: U, v: V): void {
|
||||
>V : V
|
||||
|
||||
let result = { ...tu, ...uv, id: 'qux' };
|
||||
>result : ({ ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...T; ...U; ...T; ...U; id: string; } & { ...U; id: string; }) | ({ ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; })
|
||||
>{ ...tu, ...uv, id: 'qux' } : ({ ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...T; ...U; ...T; ...U; id: string; } & { ...U; id: string; }) | ({ ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; })
|
||||
>result : { ...T & U; ...T & U; ...U; id: string; } | { ...T & U; ...T & U; ...V; id: string; }
|
||||
>{ ...tu, ...uv, id: 'qux' } : { ...T & U; ...T & U; ...U; id: string; } | { ...T & U; ...T & U; ...V; id: string; }
|
||||
>tu : any
|
||||
>uv : any
|
||||
>id : string
|
||||
>'qux' : "qux"
|
||||
|
||||
let expected: ({ ...T, ...U, id: string } & { ...U, id: string }) | ({ ...T, ...V, id: string } & { ...U, ...V, id: string });
|
||||
>expected : ({ ...T; ...U; id: string; } & { ...U; id: string; }) | ({ ...T; ...V; id: string; } & { ...U; ...V; id: string; })
|
||||
>T : T
|
||||
>U : U
|
||||
>id : string
|
||||
>U : U
|
||||
>id : string
|
||||
>T : T
|
||||
>V : V
|
||||
>id : string
|
||||
>U : U
|
||||
>V : V
|
||||
>id : string
|
||||
|
||||
let assignable: { ...(T & U), ...(U | V), id: string } = result;
|
||||
>assignable : ({ ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...T; ...U; ...T; ...U; id: string; } & { ...U; id: string; }) | ({ ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; })
|
||||
>assignable : { ...T & U; ...T & U; ...U; id: string; } | { ...T & U; ...T & U; ...V; id: string; }
|
||||
>T : T
|
||||
>U : U
|
||||
>U : U
|
||||
>V : V
|
||||
>id : string
|
||||
>result : ({ ...T; ...U; id: string; } & { ...U; ...T; ...U; id: string; } & { ...T; ...U; ...T; ...U; id: string; } & { ...U; id: string; }) | ({ ...T; ...V; id: string; } & { ...U; ...T; ...V; id: string; } & { ...T; ...U; ...T; ...V; id: string; } & { ...T; ...U; ...V; id: string; } & { ...U; ...T; ...U; ...V; id: string; } & { ...U; ...V; id: string; })
|
||||
>result : { ...T & U; ...T & U; ...U; id: string; } | { ...T & U; ...T & U; ...V; id: string; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -18,10 +18,11 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(49,12): error TS233
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(55,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ x: number; }' has no compatible call signatures.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(59,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(63,12): error TS2322: Type '{ ...U }' is not assignable to type 'U'.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(64,9): error TS2322: Type '{ ...T & V }' is not assignable to type '{ ...T & U }'.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(66,12): error TS2322: Type '{ ...U }' is not assignable to type 'U'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (18 errors) ====
|
||||
==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (19 errors) ====
|
||||
let o = { a: 1, b: 'no' }
|
||||
|
||||
/// private propagates
|
||||
@ -119,8 +120,13 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(63,12): error TS232
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
|
||||
// { ...U } is not assignable to U
|
||||
function override<U>(initial: U, override: U): U {
|
||||
function override<T,U,V>(initial: U, override: U, t: T, v: V): U {
|
||||
// { ... T & V } is not assignable to { ... T & U }
|
||||
let tvs: { ...T & V };
|
||||
let mistake: { ...T & U } = tvs;
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{ ...T & V }' is not assignable to type '{ ...T & U }'.
|
||||
// { ...U } is not assignable to U
|
||||
return { ...initial, ...override };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ ...U }' is not assignable to type 'U'.
|
||||
|
||||
@ -59,8 +59,11 @@ let callableConstructableSpread: { ...PublicX, (n: number): number, new (p: numb
|
||||
callableConstructableSpread(12); // error, no call signature
|
||||
new callableConstructableSpread(12); // error, no construct signature
|
||||
|
||||
// { ...U } is not assignable to U
|
||||
function override<U>(initial: U, override: U): U {
|
||||
function override<T,U,V>(initial: U, override: U, t: T, v: V): U {
|
||||
// { ... T & V } is not assignable to { ... T & U }
|
||||
let tvs: { ...T & V };
|
||||
let mistake: { ...T & U } = tvs;
|
||||
// { ...U } is not assignable to U
|
||||
return { ...initial, ...override };
|
||||
}
|
||||
|
||||
@ -133,7 +136,10 @@ spreadC.m(); // error 'm' is not in '{ ... c }'
|
||||
var callableConstructableSpread;
|
||||
callableConstructableSpread(12); // error, no call signature
|
||||
new callableConstructableSpread(12); // error, no construct signature
|
||||
// { ...U } is not assignable to U
|
||||
function override(initial, override) {
|
||||
function override(initial, override, t, v) {
|
||||
// { ... T & V } is not assignable to { ... T & U }
|
||||
var tvs;
|
||||
var mistake = tvs;
|
||||
// { ...U } is not assignable to U
|
||||
return __assign({}, initial, override);
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ function iteratedUnionIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tu: T | U;
|
||||
let uv: U & V;
|
||||
let result = { ...tu, ...uv, id: 'foo' };
|
||||
let expected: ({ ...T, ...U, id: string } & { ...T, ...V, id: string }) | ({ ...U, id: string } & { ...U, ...V, id: string });
|
||||
let assignable: { ...(T | U), ...(U & V), id: string } = result;
|
||||
}
|
||||
// concrete types work
|
||||
@ -16,21 +15,18 @@ let assignable: { ...(A1 & A2) } = result;
|
||||
function tripleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tuv: T & U & V;
|
||||
let result = { ...tuv, id: 'bar' };
|
||||
let expected: { ...T, id: string } & { ...U, id: string } & { ...V, id: string } = result;
|
||||
let assignable: { ...(T & U & V), id: string } = result;
|
||||
}
|
||||
function iteratedDoubleIntersection<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tu: T & U;
|
||||
let uv: U & V;
|
||||
let result = { ...tu, ...uv, id: 'baz' };
|
||||
let expected: { ...T, ...U, id: string } & { ...T, ...V, id: string } & { ...U, id: string } & { ...U, ...V, id: string };
|
||||
let assignable: { ...(T & U), ...(U & V), id: string } = result;
|
||||
}
|
||||
function iteratedIntersectionUnion<T, U, V>(t: T, u: U, v: V): void {
|
||||
let tu: T & U;
|
||||
let uv: U | V;
|
||||
let result = { ...tu, ...uv, id: 'qux' };
|
||||
let expected: ({ ...T, ...U, id: string } & { ...U, id: string }) | ({ ...T, ...V, id: string } & { ...U, ...V, id: string });
|
||||
let assignable: { ...(T & U), ...(U | V), id: string } = result;
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,10 @@ let callableConstructableSpread: { ...PublicX, (n: number): number, new (p: numb
|
||||
callableConstructableSpread(12); // error, no call signature
|
||||
new callableConstructableSpread(12); // error, no construct signature
|
||||
|
||||
// { ...U } is not assignable to U
|
||||
function override<U>(initial: U, override: U): U {
|
||||
function override<T,U,V>(initial: U, override: U, t: T, v: V): U {
|
||||
// { ... T & V } is not assignable to { ... T & U }
|
||||
let tvs: { ...T & V };
|
||||
let mistake: { ...T & U } = tvs;
|
||||
// { ...U } is not assignable to U
|
||||
return { ...initial, ...override };
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user