Skip to content

Commit e0d210d

Browse files
committed
Add tests
1 parent 00c3015 commit e0d210d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/cases/conformance/types/spread/objectSpread.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,24 @@ let a = 12;
120120
let shortCutted: { a: number, b: string } = { ...o, a }
121121
// non primitive
122122
let spreadNonPrimitive = { ...<object>{}};
123+
124+
// generic spreads
125+
function genericSpread<T, U>(t: T, u: U, v: T | U, w: T | { s: string }, obj: { x: number }) {
126+
let x01 = { ...t };
127+
let x02 = { ...t, ...t };
128+
let x03 = { ...t, ...u };
129+
let x04 = { ...u, ...t };
130+
let x05 = { a: 5, b: 'hi', ...t };
131+
let x06 = { ...t, a: 5, b: 'hi' };
132+
let x07 = { a: 5, b: 'hi', ...t, c: true, ...obj };
133+
let x09 = { a: 5, ...t, b: 'hi', c: true, ...obj };
134+
let x10 = { a: 5, ...t, b: 'hi', ...u, ...obj };
135+
let x11 = { ...v };
136+
let x12 = { ...v, ...obj };
137+
let x13 = { ...w };
138+
let x14 = { ...w, ...obj };
139+
let x15 = { ...t, ...v };
140+
let x16 = { ...t, ...w };
141+
let x17 = { ...t, ...w, ...obj };
142+
let x18 = { ...t, ...v, ...w };
143+
}

0 commit comments

Comments
 (0)