-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
I'm working on a JSON Object-Mapper which would parse a JSON string and produce typed objects, i.e.
class Bar {}
class Foo {
bar: Bar;
}
let json = '{"bar":{}}';
let foo = mapper.fromString(json, Foo);
expect(foo instanceof Foo).toBe(true);
expect(foo.bar instanceof Bar).toBe(true);For this I need design:type metadata for all properties, but I see it's emitted only if a property is decorated (also a bogus decorator will do), e.g.
class Foo { var Foo = (function () {
bar: Bar; function Foo() {
} }
return Foo;
}());
function bogus(t, k) {}
class Foo { var Foo = (function () {
@bogus bar: Bar; function Foo() {
} }
__decorate([
bogus,
__metadata('design:type', Bar)
], Foo.prototype, "bar", void 0);
return Foo;
}());
It would be very useful to have a compiler option to enable the implicit metadata decoration for all design:* metadata, without the need of an additional decorator.
Metadata
Metadata
Assignees
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScriptAn idea for TypeScript