Webstorm shows error on compiler decorator when using aliased paths for import
Hello,
I have an issue where everything compiles and runs fine when I do npm start, but webstorm is saying I have the following error on all of my component decorators in any file where I inject dependencies that I included via a path alias:
Angular: Can't resolve all parameters for myComponent in <filepath/mycomponent.ts>: ([object Object], ?, ?)
where the first dependency was simply the Router from @angular/router, and the other two are dependencies I included like so:
import { myService, myService2 } from 'services';
in my tsconfig.json, I have correctly aliased the paths:
"baseUrl": "./src",
"paths": {
"services": [ "app/services" ]
}
If I change the import to use '../../services' the error goes away.
Mind you, I DO NOT get an error on the import itself or on the actual injection, the error only appears on the component decorator itself. The app compiles fine. Running tsc in terminal shows no errors. Switching to a version of Webstorm prior to June 7th, 2017 (2017.1.4) removes the error. The error appears on both the June and August 2017 version of Webstorm. Please advise.
Please sign in to leave a comment.
The error comes from Angular service.
Looks related to https://github.com/angular/angular/issues/18484
Try disabling the service (in Settings(Preferences) | Languages & Frameworks | TypeScript, press Configure... next to Use Typescript Service, clear the Use Angular service checkbox) - does the problem persist?
This solves the issue. Funnily enough, if you go to File / Settings / Languages & Frameworks / TypeScript / Configure - that option isn't present. If instead you go to Webstorm / Settings / Languages & Frameworks / TypeScript / Configure - you get an identical screen as the other route but the Use Angular Service option is present. Unchecking it fixed the problem.
Thank you.
Unchecking angular service is like, killing the messenger! Is a solution expected anytime soon?
the issue can't be fixed on WeStorm end; please follow https://github.com/angular/angular/issues/18484 for updates to be notified when it's resolved