javascript - Create annotation with babel ES6 - Stack Overflow

admin2025-04-19  0

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 ?

Share Improve this question asked Jul 29, 2015 at 13:28 mfrachetmfrachet 8,93217 gold badges60 silver badges113 bronze badges 5
  • There are no annotations or decorators in ES6. Babel may support some experimental features though. – Bergi Commented Jul 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 Commented Jul 30, 2015 at 9:26
  • Yes, decorators are an experimental feature – Bergi Commented Jul 30, 2015 at 12:00
  • So I should not use this in production environnement ? – mfrachet Commented Jul 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 Commented Jul 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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745077913a283676.html

最新回复(0)