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

Decorators always transformed regardless of target #18713

Closed
ghost opened this issue Sep 23, 2017 · 4 comments
Closed

Decorators always transformed regardless of target #18713

ghost opened this issue Sep 23, 2017 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@ghost
Copy link

ghost commented Sep 23, 2017

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.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 25, 2017

duplicate of #16882

@mhegazy mhegazy added the Duplicate An existing issue was already created label Sep 25, 2017
@ghost
Copy link
Author

ghost commented Sep 25, 2017

So I need to wait for the new decorators proposal to be implemented?
Which is probably going to disrupt a lot of Angular code that depends on legacy decorators.

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.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 25, 2017

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.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 9, 2017

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

@mhegazy mhegazy closed this as completed Oct 9, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

1 participant