Skip to content

Commit 8b9afce

Browse files
committed
Add test
1 parent 217f558 commit 8b9afce

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//// [declarationEmit_bindingPatters.ts]
2+
3+
const k = ({x: z = 'y'}) => { }
4+
5+
var a;
6+
function f({} = a, [] = a, { p: {} = a} = a) {
7+
}
8+
9+
//// [declarationEmit_bindingPatters.js]
10+
var k = function (_a) {
11+
var _b = _a.x, z = _b === void 0 ? 'y' : _b;
12+
};
13+
var a;
14+
function f(_a, _b, _c) {
15+
var _a = a;
16+
var _b = a;
17+
var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d;
18+
}
19+
20+
21+
//// [declarationEmit_bindingPatters.d.ts]
22+
declare const k: ({x:z}: {
23+
x?: string;
24+
}) => void;
25+
declare var a: any;
26+
declare function f({}?: any, []?: any, {p: {}}?: any): void;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/declarationEmit_bindingPatters.ts ===
2+
3+
const k = ({x: z = 'y'}) => { }
4+
>k : Symbol(k, Decl(declarationEmit_bindingPatters.ts, 1, 5))
5+
>x : Symbol(x)
6+
>z : Symbol(z, Decl(declarationEmit_bindingPatters.ts, 1, 12))
7+
8+
var a;
9+
>a : Symbol(a, Decl(declarationEmit_bindingPatters.ts, 3, 3))
10+
11+
function f({} = a, [] = a, { p: {} = a} = a) {
12+
>f : Symbol(f, Decl(declarationEmit_bindingPatters.ts, 3, 6))
13+
>a : Symbol(a, Decl(declarationEmit_bindingPatters.ts, 3, 3))
14+
>a : Symbol(a, Decl(declarationEmit_bindingPatters.ts, 3, 3))
15+
>a : Symbol(a, Decl(declarationEmit_bindingPatters.ts, 3, 3))
16+
>a : Symbol(a, Decl(declarationEmit_bindingPatters.ts, 3, 3))
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
=== tests/cases/compiler/declarationEmit_bindingPatters.ts ===
2+
3+
const k = ({x: z = 'y'}) => { }
4+
>k : ({x:z}: { x?: string; }) => void
5+
>({x: z = 'y'}) => { } : ({x:z}: { x?: string; }) => void
6+
>x : any
7+
>z : string
8+
>'y' : string
9+
10+
var a;
11+
>a : any
12+
13+
function f({} = a, [] = a, { p: {} = a} = a) {
14+
>f : ({}?: any, []?: any, {p:{}}?: any) => void
15+
>a : any
16+
>a : any
17+
>p : any
18+
>a : any
19+
>a : any
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @declaration: true
2+
3+
const k = ({x: z = 'y'}) => { }
4+
5+
var a;
6+
function f({} = a, [] = a, { p: {} = a} = a) {
7+
}

0 commit comments

Comments
 (0)