Webstorm generator function not accepted

断了今生、忘了曾经 提交于 2019-12-23 09:20:11

问题


I'm trying to use iojs with koa, what works well. But Webstorm doesn't accept the generator functions as valid.

/** gets marked as syntactically invalid code */
app.use(function *() {
    this.body = 'Hello World';
}); 

My actual version is Webstorm 9. Is there maybe a workaround? I couldn't find a matching option for it.


回答1:


Go to the Preferences > Languages & Frameworks > JavaScript and chose ECMAScript 6 for JavaScript language version.



来源:https://stackoverflow.com/questions/28131742/webstorm-generator-function-not-accepted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!