File: metadataOfUnion.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 (99 lines) | stat: -rw-r--r-- 2,384 bytes parent folder | download | duplicates (4)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//// [metadataOfUnion.ts]
function PropDeco(target: Object, propKey: string | symbol) { }

class A {
}

class B {
    @PropDeco
    x: "foo" | A;

    @PropDeco
    y: true | boolean;

    @PropDeco
    z: "foo" | boolean;
}

enum E {
    A,
    B,
    C,
    D
}

class D {
    @PropDeco
    a: E.A;

    @PropDeco
    b: E.B | E.C;

    @PropDeco
    c: E;

    @PropDeco
    d: E | number;
}

//// [metadataOfUnion.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
function PropDeco(target, propKey) { }
var A = /** @class */ (function () {
    function A() {
    }
    return A;
}());
var B = /** @class */ (function () {
    function B() {
    }
    __decorate([
        PropDeco,
        __metadata("design:type", Object)
    ], B.prototype, "x");
    __decorate([
        PropDeco,
        __metadata("design:type", Boolean)
    ], B.prototype, "y");
    __decorate([
        PropDeco,
        __metadata("design:type", Object)
    ], B.prototype, "z");
    return B;
}());
var E;
(function (E) {
    E[E["A"] = 0] = "A";
    E[E["B"] = 1] = "B";
    E[E["C"] = 2] = "C";
    E[E["D"] = 3] = "D";
})(E || (E = {}));
var D = /** @class */ (function () {
    function D() {
    }
    __decorate([
        PropDeco,
        __metadata("design:type", Number)
    ], D.prototype, "a");
    __decorate([
        PropDeco,
        __metadata("design:type", Number)
    ], D.prototype, "b");
    __decorate([
        PropDeco,
        __metadata("design:type", Number)
    ], D.prototype, "c");
    __decorate([
        PropDeco,
        __metadata("design:type", Number)
    ], D.prototype, "d");
    return D;
}());