HTML文件显示HTML元素的TypeScript错误

HTML文件显示HTML元素的TypeScript错误

本文介绍了WebStorm HTML文件显示HTML元素的TypeScript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我安装了WebStorm的新副本,并打开了一个现有的Angular项目.

I installed a fresh copy of WebStorm and opened up an existing Angular project.

当我在项目中打开任何HTML文件时,IDE都会显示.html文件中所有div标记的'Cannot find div'.在几秒钟的时间内,IDE正常运行,然后显示"2.5.3 Typescript"选项卡,其中列出了TypeScript错误.

When I open up any HTML file in the project the IDE shows 'Cannot find div' for all div tags in the .html file. For a few seconds the IDE is fine, then it shows a '2.5.3 Typescript' tab with a list of TypeScript errors.

Some Typescript tab errors:
Error:(1, 2) TS2304: Cannot find name 'div'.
Error:(3, 4) TS2304: Cannot find name 'div'.
Error:(3, 9) TS2304: Cannot find name 'ngIf'.

我尝试使缓存无效并重新启动.我尝试禁用TSLint.我尝试为某些属性/标签注入语言.

I've tried invalidating the cache and restarting. I've tried disabling TSLint. I've tried injecting language for some of the attributes/tags.

甚至index.html也会引发一堆TypeScript错误.

Even index.html throws a bunch of TypeScript errors.

  <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title></title>
      <base href="/">

      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="icon" type="image/x-icon" href="">
    </head>
    <body>
    </body>
    </html>

我希望.html文件中没有红色的波浪形标记,因为它们都是有效的.在VS Code中可以正常工作.

I expect no red squiggly marks in the .html file since it is all valid.It works fine in VS Code.

推荐答案

已知问题, WEB-36373 已在2018.3.3中修复.

Known issue, WEB-36373 is fixed in 2018.3.3.

就目前而言,我建议在设置" |关闭"中选择 Angular语言服务.语言和框架| TypeScript (所有角度功能仍将可用)

For now, I can suggest turning Angular language service off in Settings | Languages & Frameworks | TypeScript (all the angular functionality will still be available)

这篇关于WebStorm HTML文件显示HTML元素的TypeScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 09:52