Skip to content

Commit 86040e0

Browse files
committed
Add more tests
1 parent d548f6a commit 86040e0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/cases/compiler/destructuringAssignmentWithDefault.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,25 @@ let x = 0;
88
function f1(options?: { color?: string, width?: number }) {
99
let { color, width } = options || {};
1010
({ color, width } = options || {});
11+
let x1 = (options || {}).color;
12+
let x2 = (options || {})["color"];
1113
}
1214

1315
function f2(options?: [string?, number?]) {
1416
let [str, num] = options || [];
1517
[str, num] = options || [];
18+
let x1 = (options || {})[0];
19+
}
20+
21+
function f3(options?: { color: string, width: number }) {
22+
let { color, width } = options || {};
23+
({ color, width } = options || {});
24+
let x1 = (options || {}).color;
25+
let x2 = (options || {})["color"];
26+
}
27+
28+
function f4(options?: [string, number]) {
29+
let [str, num] = options || [];
30+
[str, num] = options || [];
31+
let x1 = (options || {})[0];
1632
}

0 commit comments

Comments
 (0)