I m actually developping an application using babeljs and ES6 (with .js files) and I was wondering if it was possible to create annotations, like we can do with typescript, using babeljs and ES6 ?
I m actually developping an application using babeljs and ES6 (with .js files) and I was wondering if it was possible to create annotations, like we can do with typescript, using babeljs and ES6 ?
javascript
ecmascript-6
babeljs
Share
Improve this question
asked Jul 29, 2015 at 13:28
mfrachetmfrachet8,9321717 gold badges6060 silver badges113113 bronze badges5
There are no annotations or decorators in ES6. Babel may support some experimental features though.
– Bergi
CommentedJul 29, 2015 at 13:59
What do you mean by "experimental features" ? I tried it and it seems to work as I expect. I should not use it in production environnment ?
– mfrachet
CommentedJul 30, 2015 at 9:26
Yes, decorators are an experimental feature
– Bergi
CommentedJul 30, 2015 at 12:00
So I should not use this in production environnement ?
– mfrachet
CommentedJul 30, 2015 at 12:04
Rather not I'd say. From that page: "use with extreme caution. Babel may update without warning in order to track spec changes.". You'll have to decide yourself if you want to live with that.
– Bergi
CommentedJul 30, 2015 at 12:07
Add a ment
|
1 Answer
1
Reset to default
4
JavaScript doesn't have a construct identical to TypeScript annotations (all kinds of them). There is however a proposal for Decorators for ES7, and BabelJS does implement that (With the appropriate configuration). Here's a nice article describing the differences between the two.