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

Regression: decorator must be on first of the defined property methods #12554

Copy link
Copy link
@wardbell

Description

@wardbell
Issue body actions

TypeScript Version: 2.1.1

In 2.0.10, a decorator such as the Angular @Input decorator could appear on the second of the two methods implementing a defined property. As of 2.1.1, you get an error unless it appears on the first.

Expected behavior:
The code should work as it does when transpiled with 2.0.10

Actual behavior:
The code fails with 2.1.1

Repro
Here is my plunker. Follow the README.

To see that changing the TypeScript version controls the outcome,
open config.js and toggle the TypeScript version to 2.0.10 to see that the code works fine when the decorator is on the second property method.

I compared the generated JS under TS 2.0.10 and 2.1.1.
The latter, failing version is missing the following important code:

  __decorate([
            core_1.Input(), 
            __metadata('design:type', Number)
        ], CustomComponent.prototype, "selectedSection", null);

This explains why the Angular app fails: Angular can't find that decorator and therefore proclaims that the CustomComponent does not have a bindable selectedSection property.

View Angular issue "Setter @Input binding not working after upgrading to 2.2.3 from 2.1.2 " see how this issue arose, That issue is closed because we believe this is actually a TS issue.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScript

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.