vue3加ts 中的.vue文件一直报错 Type annotations can only be used in TypeScript files.

_阿锋丶 2020-11-27 09:53:07
...全文
5915 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
々╋殇や』々 2022-11-02
  • 打赏
  • 举报
回复 8

vue的单文件组件.vue里使用ts报这种错,你可以试着把vscode底下的那个蓝条上面的语言模式改成vue,而不是HTML,这样就不报错了

img

  • 举报
回复
@々╋殇や』々 有用,谢谢
新鸟菜手 2023-04-15
  • 举报
回复
@花开ლ花落ω终败 谢谢
_阿锋丶 2020-11-27
  • 打赏
  • 举报
回复
我解决了 这代码 是没有用 我就是想表达 我这个文件一直 有这个错误 下面我的博客 贴出来了 有兴趣 可以看看 谢谢 你的回答 https://blog.csdn.net/weixin_43342105/article/details/110225400
  • 举报
回复
@_阿锋丶 可是注销了之后就没有代码自动补全了呀
Pro TypeScript. Application-Scale JavaScript Development Steve Fenton page 300 TypeScript is a language created and maintained by Microsoft, and released under an open-source Apache 2.0 License (2004). The language is focused on making the development of JavaScript programs scale to many thousands of lines of code. In fact, Microsoft has written both the Azure Management Portal (1.2 million lines of code) and the Visual Studio Code editor (300,000 lines of code) in TypeScript. The language attacks the large-scale JavaScript programming problem by offering better design-time tooling, compiletime checking, and dynamic module loading at runtime. As you might expect from a language created by Microsoft, there is excellent support for TypeScript within Visual Studio, but plenty of other development tools have also added support for the language, including VS Code, WebStorm, Eclipse, Sublime Text, Vi, Atom, IntelliJ, and Emacs among others. The widespread support from these tools as well as the permissive open-source license makes TypeScript a viable option outside of the traditional Microsoft ecosystem. The TypeScript language is a typed superset of JavaScript, which is compiled to plain JavaScript in the flavor of your choosing. This makes programs written in TypeScript highly portable as they can run on almost any machine — in web browsers, on web servers, and even in native applications on operating systems that expose a JavaScript API, such as WinJS. The language features found in TypeScript can be divided into three categories based on their relationship to JavaScript (see Figure 1). The first two sets are related to versions of the ECMA-262 ECMAScript Language Specification, which is the official specification for JavaScript. The ECMAScript 5 specification forms the basis of TypeScript and supplies the largest number of features in the language. Subsequent versions of the ECMAScript specification are rolled into TypeScript releases, often as early previews that fe

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧