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 ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.