-
Notifications
You must be signed in to change notification settings - Fork 13k
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
TypeScript Version: 2.0.2.0 beta
Code
function PropDeco(target: Object, propKey: string | symbol) { }
class Foo {
@PropDeco
public foo: "foo" | "bar";
}
--experimentalDecorators --emitDecoratorMetadata
Expected behavior:
Since the runtime type of Foo.foo
is String
, I believe the compiler should emit the following metadata definition:
__metadata('design:type', String)
Full code:
function PropDeco(target, propKey) { }
var Foo = (function () {
function Foo() {
}
__decorate([
PropDeco,
__metadata('design:type', String)
], Foo.prototype, "foo", void 0);
return Foo;
}());
Actual behavior:
However, instead of String
, the compiler emits Object
as the detected type of Foo.foo
:
__metadata('design:type', Object)
Full code:
function PropDeco(target, propKey) { }
var Foo = (function () {
function Foo() {
}
__decorate([
PropDeco,
__metadata('design:type', Object)
], Foo.prototype, "foo", void 0);
return Foo;
}());
I believe this is incorrect.
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