Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Typescript incorrectly emits metadata type 'Object' for custom classes #13098

Copy link
Copy link
@pklicnik

Description

@pklicnik
Issue body actions

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

Reactions are currently unavailable

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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.