We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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:
Foo.foo
String
__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:
Object
__metadata('design:type', Object)
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.
The text was updated successfully, but these errors were encountered:
We should do this for all literal types, including boolean, enum, number, and string.
Sorry, something went wrong.
For union or intersection types use constituent serialized type if it…
40c2a53
…s same for all of the constituent types Fixes #10809
sheetalkamat
No branches or pull requests
TypeScript Version: 2.0.2.0 beta
Code
Expected behavior:
Since the runtime type of
Foo.foo
isString
, I believe the compiler should emit the following metadata definition:Full code:
Actual behavior:
However, instead of
String
, the compiler emitsObject
as the detected type ofFoo.foo
:Full code:
I believe this is incorrect.
The text was updated successfully, but these errors were encountered: