forked from microsoft/TypeScript
/
destructuringInFunctionType.js
70 lines (60 loc) · 1.33 KB
/
destructuringInFunctionType.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//// [destructuringInFunctionType.ts]
interface a { a }
interface b { b }
interface c { c }
type T1 = ([a, b, c]);
type F1 = ([a, b, c]) => void;
type T2 = ({ a });
type F2 = ({ a }) => void;
type T3 = ([{ a: b }, { b: a }]);
type F3 = ([{ a: b }, { b: a }]) => void;
type T4 = ([{ a: [b, c] }]);
type F4 = ([{ a: [b, c] }]) => void;
type C1 = new ([{ a: [b, c] }]) => void;
var v1 = ([a, b, c]) => "hello";
var v2: ([a, b, c]) => string;
//// [destructuringInFunctionType.js]
var v1 = function (_a) {
var a = _a[0], b = _a[1], c = _a[2];
return "hello";
};
var v2;
//// [destructuringInFunctionType.d.ts]
interface a {
a: any;
}
interface b {
b: any;
}
interface c {
c: any;
}
declare type T1 = ([a, b, c]);
declare type F1 = ([a, b, c]: [any, any, any]) => void;
declare type T2 = ({
a: any;
});
declare type F2 = ({ a }: {
a: any;
}) => void;
declare type T3 = ([{
a: b;
}, {
b: a;
}]);
declare type F3 = ([{ a }, { b }]: [{
a: any;
}, {
b: any;
}]) => void;
declare type T4 = ([{
a: [b, c];
}]);
declare type F4 = ([{ a: [b, c] }]: [{
a: [any, any];
}]) => void;
declare type C1 = new ([{ a: [b, c] }]: [{
a: [any, any];
}]) => void;
declare var v1: ([a, b, c]: [any, any, any]) => string;
declare var v2: ([a, b, c]: [any, any, any]) => string;