VSCode提示:Type annotations can only be used in TypeScript files

react native 16.13 版本,使用react官方cli建立的初始项目中,文件App.js 有一行代码:react

const App: () => React$Node = () => {

会在vscode中,报语法错误:code

Type annotations can only be used in TypeScript files

只须要在设置中配置一下,具体路径为:ip

  • Settings - User - Extentsions - TypeScript - JavaScript - Validate: Enable

取消勾选便可。io

相关文章
相关标签/搜索