admin管理员组文章数量:1434908
I'm using the proposed private field syntax in my JavaScript but VS Code says this is a syntax error:
The specific error is: Invalid character. ts(1127)
How can I make VS Code understand private fields?
I'm using the proposed private field syntax in my JavaScript but VS Code says this is a syntax error:
The specific error is: Invalid character. ts(1127)
How can I make VS Code understand private fields?
Share Improve this question asked Jan 8, 2020 at 7:05 Matt BiernerMatt Bierner 66.1k24 gold badges198 silver badges230 bronze badges1 Answer
Reset to default 7Cause
VS Code uses the TypeScript project to power both its JavaScript and TypeScript IntelliSense. The TypeScript project only added support for private fields in TypeScript 3.8. However the current release of VS Code (1.41) only includes the latest stable TypeScript 3.7 release.
If you see syntax errors for private fields, you are likely using a version of TypeScript in VS Code that does not yet understand private fields.
Workaround
VS Code 1.43 (to be released early March 2020) will include TypeScript 3.8. Until then, you can upgrade your workspace to use a newer typescript version by either:
Installing this extension
Following these instructions
Keep in mind that other VS Code extensions—such as linters—may also need to be updated with support for private fields
本文标签: typescriptHow can I use JavaScript private fields in VS CodeStack Overflow
版权声明:本文标题:typescript - How can I use JavaScript private fields in VS Code? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745645938a2668137.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论