Angular 2: syntax highlight on providers from factory

I am using the following provider:

providers: [
{
provide: Http,
useFactory: (backend: XHRBackend, defaultOptions: RequestOptions) => {
return new HttpWithAuth(backend, defaultOptions);
},
deps: [XHRBackend, RequestOptions],
},

The `HttpWithAuth` class has a method `getWithoutAuth()`, but - since I am using it as Http - the syntax:

constructor(private http: Http){}

this.http.getWithoutAuth();

produces red color on the method name, as not resolved.

Am I missing some info/settings or is that a current limitation of WebStorm?

0

Please can you provide full code snippets? Where does the problem occur? What does the method usage look like? I don't understand what is meant by 'using it as Http'. Also, what error do you see? Please attach a screenshot that shows the error message

0

As you see, the code is using an instance of `HttpWithAuth` class as Http service. While the `HttpWithAuth` does contain the method `getWithoutAuth`, the IDE appears to be somehow fooled into thinking that an instance of angular/http Http service is actually used (sorry if I sound naive here - I am trying to descibe the symptom). Thus, in the invocation `this.http.getWithoutAuth()`, the method name is colored red as unresolved.

0

Please can you provide the code snippets I can use to recreate the issue?

0

请先登录再写评论。