I'm trying to migrate my app from Angular v5 to v6 and I face the following typescript error while trying to specify providedIn
in my providers
Argument type {providedIn: "root"} is not assignable to parameter type {providedIn: Type | "root" | null} & InjectableProvider
@Injectable({
providedIn: 'root',
})
export class MyService {
}
I copied and pasted the code from the Angular doc https://angular.io/guide/dependency-injection
Any idea?
UPDATE
I have created a blank project ng new ...
and added a provider ng g service my-new-service
, opened the project in WebStorm and everything was ok, I didn't face any error with that dummy project
UPDATE
I contacted the WebStorm support, it turns out that this is a known bug of WebStorm https://youtrack.jetbrains.com/issue/WEB-32634
UPDATE
Webstorm 2018.1.4 (not yet released) should fix the issue, see https://youtrack.jetbrains.com/issue/WEB-32634
UPDATE
Webstorm team moved the fix to 2018.1.5
UPDATE
Sunday 17th June 2018, the Webstorm fix has been released