-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
When I compile this code:
class A {
constructor() { console.log('new A'); }
}
type AType = A;
function decorator(target: Object, propertyKey: string) {
}
export class B {
@decorator
x: AType = new A();
}
The emitter produces the following code:
var A = (function () {
function A() {
console.log('new A');
}
return A;
})();
function decorator(target, propertyKey) {
}
var B = (function () {
function B() {
this.x = new A();
}
__decorate([
decorator,
__metadata('design:type', Object)
], B.prototype, "x");
return B;
})();
exports.B = B;
But the expected output for metadata should be __metadata('design:type', A)
. Furthermore, if I change the param declaration to x: A = new A();
, the emitter will output __metadata('design:type', )
(type not specified at all).
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue