Skip to content
New issue

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 incorrectly emits metadata type 'Object' for custom classes #13098

Closed
pklicnik opened this issue Dec 21, 2016 · 1 comment
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@pklicnik
Copy link

TypeScript Version: 2.1.4

Code

module MyModule {

  export function inject(target: any, key: string): void {}

  export class Leg {}

  export class Person {
    @inject leftLeg: Leg;
  }

}

Compiled with:
tsc --experimentalDecorators --emitDecoratorMetadata -target es5 app.ts

Expected behavior:
The design:type metadata inserted uses type Object instead of the actual type

__decorate([
    inject,
    __metadata("design:type", Object)
], Person.prototype, "leftArm", void 0);

Actual behavior:
The design:type metadata should be set to the correct type (Leg in this case)

__decorate([
    inject,
    __metadata("design:type", Leg)
], Person.prototype, "leftArm", void 0);

Note: This was working in previous version (we were on 1.8.10) and broke after upgrading to 2.1.4

@pklicnik
Copy link
Author

pklicnik commented Jan 6, 2017

@mhegazy Any idea when 2.1.5 is being released to npm?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants