Skip to content

decoratorMetadataEmit not compatible with Babel's 6-to-5 #2836

Closed
@alexeagle

Description

@alexeagle

I believe it's expected that tsc -t es6 should be externally transpilable to ES5 (eg with Babel)

See https://gist.github.com/alexeagle/24243fbb87dbd8bad6f1

Babel replaces the __decorate line this.__decorate with undefined.__decorate so that gives a runtime error. Uncaught TypeError: Cannot read property '__decorate' of undefined app_bin.js:7

Note I also tried this with Closure Compiler ES6->ES5, and had a different problem because of this line in the emit:
Object.defineProperty(App, "name", { value: "App", configurable: true });
in ES6 spec, new objects are configurable:true by default, but in mainline Chrome it is configurable:false by default so this is also a runtime error. For this case, it leads me to wonder if ES5->ES6 transpilers should be expected to translate API incompatibilities in addition to new ES6 syntax.

Metadata

Metadata

Assignees

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