Skip to content

Decorators always transformed regardless of target #18713

Closed

Description

TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
2.6.0-dev.20170922
Code

tsconfig.json

{
	"compilerOptions": {
		"target": "esnext",
		"experimentalDecorators": true
	}
}
function foo() {
	return f => f;
}

@foo()
class Foo {}

Expected behavior:
Decorator is emitted as-is because target is esnext.

Actual behavior:
Decorator is transformed to __decorate call.

I want to let all of the ECMAScript features be transpiled by Babel.

Activity

  1. mhegazy commented on Sep 25, 2017

    @mhegazy
    Contributor

    duplicate of #16882

  2. mhegazy commented on Sep 25, 2017

    @mhegazy
    Contributor

    So I need to wait for the new decorators proposal to be implemented?

    yes

    Which is probably going to disrupt a lot of Angular code that depends on legacy decorators.

    We hope the roll-out will be coordinated with the Angular team to make sure the decorators can handle both versions of the proposal so only user-defined decorators would need to change.

    There's a legacy decorators Babel transform I intend to use here. I don't think it would break anything if you just output the decorators as they appear in the source, for esnext.

    It is not only the transforms, the decorator implementation as it stands today can not be labeled esNext. once we implement the new proposal we can safely label it as such.

  3. mhegazy commented on Oct 9, 2017

    @mhegazy
    Contributor

    Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

  4. locked and limited conversation to collaborators on Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions