Skip to content

Commit 0895fd6

Browse files
committed
Accept new baselines
1 parent d0795af commit 0895fd6

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

tests/baselines/reference/destructuringAssignmentWithDefault.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,33 @@
22
const a: { x?: number } = { };
33
let x = 0;
44
({x = 1} = a);
5+
6+
// Repro from #26235
7+
8+
function f1(options?: { color?: string, width?: number }) {
9+
let { color, width } = options || {};
10+
({ color, width } = options || {});
11+
}
12+
13+
function f2(options?: [string?, number?]) {
14+
let [str, num] = options || [];
15+
[str, num] = options || [];
16+
}
517

618

719
//// [destructuringAssignmentWithDefault.js]
820
var _a;
921
var a = {};
1022
var x = 0;
1123
(_a = a.x, x = _a === void 0 ? 1 : _a);
24+
// Repro from #26235
25+
function f1(options) {
26+
var _a;
27+
var _b = options || {}, color = _b.color, width = _b.width;
28+
(_a = options || {}, color = _a.color, width = _a.width);
29+
}
30+
function f2(options) {
31+
var _a;
32+
var _b = options || [], str = _b[0], num = _b[1];
33+
_a = options || [], str = _a[0], num = _a[1];
34+
}

tests/baselines/reference/destructuringAssignmentWithDefault.symbols

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,37 @@ let x = 0;
1010
>x : Symbol(x, Decl(destructuringAssignmentWithDefault.ts, 2, 2))
1111
>a : Symbol(a, Decl(destructuringAssignmentWithDefault.ts, 0, 5))
1212

13+
// Repro from #26235
14+
15+
function f1(options?: { color?: string, width?: number }) {
16+
>f1 : Symbol(f1, Decl(destructuringAssignmentWithDefault.ts, 2, 14))
17+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12))
18+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23))
19+
>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 6, 39))
20+
21+
let { color, width } = options || {};
22+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 7, 9))
23+
>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 7, 16))
24+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12))
25+
26+
({ color, width } = options || {});
27+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 8, 6))
28+
>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 8, 13))
29+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12))
30+
}
31+
32+
function f2(options?: [string?, number?]) {
33+
>f2 : Symbol(f2, Decl(destructuringAssignmentWithDefault.ts, 9, 1))
34+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12))
35+
36+
let [str, num] = options || [];
37+
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9))
38+
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13))
39+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12))
40+
41+
[str, num] = options || [];
42+
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9))
43+
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13))
44+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12))
45+
}
46+

tests/baselines/reference/destructuringAssignmentWithDefault.types

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,50 @@ let x = 0;
1616
>1 : 1
1717
>a : { x?: number | undefined; }
1818

19+
// Repro from #26235
20+
21+
function f1(options?: { color?: string, width?: number }) {
22+
>f1 : (options?: { color?: string | undefined; width?: number | undefined; } | undefined) => void
23+
>options : { color?: string | undefined; width?: number | undefined; } | undefined
24+
>color : string | undefined
25+
>width : number | undefined
26+
27+
let { color, width } = options || {};
28+
>color : string | undefined
29+
>width : number | undefined
30+
>options || {} : { color?: string | undefined; width?: number | undefined; }
31+
>options : { color?: string | undefined; width?: number | undefined; } | undefined
32+
>{} : {}
33+
34+
({ color, width } = options || {});
35+
>({ color, width } = options || {}) : { color?: string | undefined; width?: number | undefined; }
36+
>{ color, width } = options || {} : { color?: string | undefined; width?: number | undefined; }
37+
>{ color, width } : { color: string | undefined; width: number | undefined; }
38+
>color : string | undefined
39+
>width : number | undefined
40+
>options || {} : { color?: string | undefined; width?: number | undefined; }
41+
>options : { color?: string | undefined; width?: number | undefined; } | undefined
42+
>{} : {}
43+
}
44+
45+
function f2(options?: [string?, number?]) {
46+
>f2 : (options?: [(string | undefined)?, (number | undefined)?] | undefined) => void
47+
>options : [(string | undefined)?, (number | undefined)?] | undefined
48+
49+
let [str, num] = options || [];
50+
>str : string | undefined
51+
>num : number | undefined
52+
>options || [] : [(string | undefined)?, (number | undefined)?]
53+
>options : [(string | undefined)?, (number | undefined)?] | undefined
54+
>[] : []
55+
56+
[str, num] = options || [];
57+
>[str, num] = options || [] : [(string | undefined)?, (number | undefined)?]
58+
>[str, num] : [string | undefined, number | undefined]
59+
>str : string | undefined
60+
>num : number | undefined
61+
>options || [] : [(string | undefined)?, (number | undefined)?]
62+
>options : [(string | undefined)?, (number | undefined)?] | undefined
63+
>[] : []
64+
}
65+

0 commit comments

Comments
 (0)