File: contextuallyTypedBindingInitializer.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (51 lines) | stat: -rw-r--r-- 1,567 bytes parent folder | download | duplicates (7)
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
//// [contextuallyTypedBindingInitializer.ts]
interface Show {
    show: (x: number) => string;
}
function f({ show = v => v.toString() }: Show) {}
function f2({ "show": showRename = v => v.toString() }: Show) {}
function f3({ ["show"]: showRename = v => v.toString() }: Show) {}

interface Nested {
    nested: Show
}
function ff({ nested = { show: v => v.toString() } }: Nested) {}

interface Tuples {
    prop: [string, number];
}
function g({ prop = ["hello", 1234] }: Tuples) {}

interface StringUnion {
    prop: "foo" | "bar";
}
function h({ prop = "foo" }: StringUnion) {}

interface StringIdentity {
    stringIdentity(s: string): string;
}
let { stringIdentity: id = arg => arg }: StringIdentity = { stringIdentity: x => x};




//// [contextuallyTypedBindingInitializer.js]
function f(_a) {
    var _b = _a.show, show = _b === void 0 ? function (v) { return v.toString(); } : _b;
}
function f2(_a) {
    var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v.toString(); } : _b;
}
function f3(_a) {
    var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v.toString(); } : _b;
}
function ff(_a) {
    var _b = _a.nested, nested = _b === void 0 ? { show: function (v) { return v.toString(); } } : _b;
}
function g(_a) {
    var _b = _a.prop, prop = _b === void 0 ? ["hello", 1234] : _b;
}
function h(_a) {
    var _b = _a.prop, prop = _b === void 0 ? "foo" : _b;
}
var _a = { stringIdentity: function (x) { return x; } }.stringIdentity, id = _a === void 0 ? function (arg) { return arg; } : _a;