Angular components/directives are not recognized in WebStorm 2017.3.1

Hi, I have updated WebStorm to 2017.3.1 and now, when I create new Angular (v.5) components or directives from scratch (no generated by Angular-Cli), they are not recognized anymore. Previously I had the 2017.2.x version and it worked fine.

It might seem a real error or a mistake in the TSLint configuration but it's not:

  • I'm using an empty new AngularCli project, 
  • the application/example works fine 
  • the error is not shown anymore after WebStorm reboot.

Anyway this issue still persists in my unit / integration tests, after reboot too.
In fact I always see this warning in my following test, after reboot too:

WARNING: 



CODE:

import { Component, ElementRef, ViewChild } from '@angular/core';
import { HighchartsComponent } from './highcharts.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';

@Component({ // <==== HERE THE ERROR SHOWN ABOVE <======
selector: 'test-host-component',
template: '<fb-chart [config]="chartData"></fb-chart>'
})
export class TestHostComponent {
@ViewChild(HighchartsComponent) component: HighchartsComponent;
// ...
}

describe('Highcharts component', () => {

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [TestHostComponent, HighchartsComponent],
});

//...
})

})


NOTE: I would like to avoid disabling Angular Services in WebStorm, as suggested in other posts

Thanks in advance
Fabio

 

1
4 comments
Avatar
Permanently deleted user

Just tried the 2017.3.2 EAP version and the problem is still there.

As you can see from the screenshot below I have a created a new empty component, declared to app.module but I always see the warning:


0

The error comes from Angular language service.
Looks related to https://github.com/angular/angular/issues/14961; see if updating Typescript to 2.5.2+ helps.

You can either disable the service in preferences (Settings | Languages & Frameworks | TypeScript, Angular language service checkbox), or restart it once the issue occurs: just press the Restart service button in Typescript tool window toolbar

0
Avatar
Permanently deleted user

Hi Elena, thank you very much for the quick response.
I have updated the project to work with the latest version of Typescript but nothing.
The problem is still there, even if I "restart the service" as you suggested.

I don't know what to do anymore in order to fix this issue :( 

UPDATE:  your trick to restart the service works for my components but not in unit test : )

Fabio

0

Please sign in to leave a comment.