reflection - Decorate all properties with type metadata in TypeScript -
given code:
class foo { text: string; }
typescript produce javascript:
var foo = (function () { function foo() { } return foo; }());
but if decorate text
decorator, such function bar(t, k) {}
this:
class foo { @bar text: string; }
typescript produce:
var foo = (function () { function foo() { } __decorate([ bar, __metadata('design:type', string) ], foo.prototype, "text", void 0); return foo; }());
that is, decorates text
bar
function and design:type
metadata. great, i'd instruct typescript decorate all properties design:type
metadata, without need of bogus decorator @bar
.
is possibile in latest typescript? if not (see comments) suggestions on how use compiler api achieve this?
Comments
Post a Comment