如何使VS Code识别ES7绑定运算符 [英] How to make VS Code recognize the ES7 bind operator

查看:292
本文介绍了如何使VS Code识别ES7绑定运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS Code无法立即识别ES7绑定语法。而是,它显示为语法错误:

VS Code does not recognize the ES7 bind syntax out of the box. Instead, it shows up as a syntax error:

代码中突出显示错误的示例

[ts] Declaration or statement expected.




  • 我到处搜索以查看是否有扩展名可以帮助您

  • 我还尝试将VS Code配置为使用我自己的 .eslintrc ,这也没有。似乎行得通。到目前为止,我什至无法确认VS Code能够识别我的 .eslintrc 文件并将其用于自己的配置。

    • I've searched around to see if there's an extension that can help recognize it to no avail.
    • I've also tried to configure VS Code to use my own .eslintrc, which also doesn't seem to work. So far I haven't even been able to confirm VS Code recognizes my .eslintrc file and is using it for its own config.
    • 有人知道如何配置VS Code以识别语法吗?我意识到这是一个 Stage 0 功能,但是我觉得这很普遍。我也意识到我看到的是TypeScript错误,但是禁用TypeScript棉绒并不能消除该错误。我认为它只是显示为从JavaScript继承的TypeScript错误。

      Does anyone have an idea of how to configure VS Code to recognize the syntax? I realize it's a Stage 0 feature, however I feel it's fairly common at this point. I also realize what I'm seeing is a TypeScript error, however disabling TypeScript linting does not remove the error. I think it just shows up as a TypeScript error, inherited from JavaScript.

      经过大量搜索之后,有太多关于如何使用它的文章,但几乎没有当涉及到VS Code时。

      After a lot of searching, there's so many articles on how it can be used, but almost nothing when it comes to VS Code.

      推荐答案

      如果您使用Typescript,这是一个Typescript错误(尽管您会得到相同的错误JS)。而且Typescript是不打算支持运营商,主要是因为TC39提案已死。目前尚无计划在JS或TS中支持它,只有Babel可以这样做(实验上)。它不是ES7,甚至没有计划在某个时候出现在规格中,因此有充分的理由是SyntaxError。

      If you use Typescript, this is a Typescript error (although you would get the same error with JS). And Typescript is not planning to support the operator, mainly because the TC39 proposal is dead. There are not yet plans to support it in JS or TS, only Babel does (experimentally). It is not ES7, and it is not even planned to be in the specs somewhen, so it is a SyntaxError for a good reason.


      经过大量搜索之后,有太多关于如何使用它的文章

      After a lot of searching, there's so many articles on how it can be used

      如果这些文章没有提到运算符是仍处于早期建议阶段,我不再将它们用作可靠的资源。

      If those articles didn't mention that the operator is still in an early proposal phase, I wouldn't use them as reliable ressources anymore.

      这篇关于如何使VS Code识别ES7绑定运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆