wanderinghealer
wanderinghealer

Reputation: 71

WebStorm HTML files are showing TypeScript errors for HTML elements

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

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'.

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

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>

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

Upvotes: 3

Views: 1591

Answers (1)

lena
lena

Reputation: 93868

Known issue, WEB-36373 is fixed in 2018.3.3.

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

Upvotes: 10

Related Questions