Typescript Typing - "Cannot find declaration to go to"

I'm working on an angular 2 project and was previously using IntelliJ IDEA 2016.1.3 (IU-145.1617.8) for development, which proceeded fine.

I just today updated to IntelliJ IDEA 2016.2.1 (IU-162.1447.26), and it appears that the IDE can no longer find any of the typings for the Angular 2 classes.. Whenever I try to go to the declaration of any imported class, it gives me a Cannot find declaration to go to, and all of the imported classes that I'm currently using are getting inspection warnings.

Is this a bug, or did something change with that update that I am unaware of?

5 comments
Comment actions Permalink

can you provide a project that shows up the issue? It shouldn't necessary be your actual project, just a simple app with similar configuration that can be used to recreate the issue

1
Comment actions Permalink

I tried reproducing the issue using a generated project with the angular-cli, but it seems that IntelliJ is able to properly detect the classes in that project.

Both of the projects that I am currently experiencing my issues in are based on the angular2-webpack-starter, and it seems that the webpack-starter is suffering from the same issue.

You can duplicate the issue I'm running into by cloning 'https://github.com/AngularClass/angular2-webpack-starter.git', running npm install, and importing the project into IntelliJ.

1
Comment actions Permalink

what files should i look at? I inspected several .ts files there - everything works as expected...

1
Comment actions Permalink

In src/app/app.component.ts, @Component should be throwing an inspection error stating that there are an invalid number of arguments. If you try going to the declaration of the Component class, it should take you to the wrong file. If you try going to the declaration of the ViewEncapsulation class, it should tell you that it 'Cannot find declaration to go to'.

1
Comment actions Permalink

Thanks!

Bug is logged as https://youtrack.jetbrains.com/issue/WEB-22697, should be fixed in next update.

As a workaround I'd suggest enabling TypeScript compiler service (to replace WebStorm own highlighting/completion with the one provided by service)

0

Please sign in to leave a comment.