Skip to content

Emitted decorator metadata is different when --isolatedModules is set #8355

Closed
@jpsfs

Description

@jpsfs

Hi,

I'm facing an issue while compiling an Angular 2 application with the IsolatedModules flag set to true.
If IsolatedModules is set to false everything works as expect.

The emitted decorator metadata is different. Is this by design or a bug?

My problem is that my module is getting bigger by the day and using this flag I can greatly improve the CompileOnSave experience.

TypeScript Version:

1.8.7

Code

import * as ng from "angular2/core";

@ng.Decorator({
...
})
export class MyClass{
     constructor(private el: ng.ElementRef) {
     }
}

Expected behavior:
If the isolatedModules flag is set to false:

...
MyClass = __decorate([
      ng.Directive({
            selector: '[my-selector]',
      }), 
      __metadata('design:paramtypes', [ng.ElementRef]) // <<<<<<<<<<<<<<<<<<<
], MyClass);

Actual behavior:

If the isolatedModules flag is set to true:

...
MyClass = __decorate([
      ng.Directive({
            selector: '[my-selector]',
      }), 
      __metadata('design:paramtypes', [Object]) // <<<<<<<<<<<<<<<<<<<<<<<
], MyClass);

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions