ngx-translate/http-loader

Error in http-loader.d.ts

Davilink opened this issue · 5 comments

I'm submitting a ... (check one with "x")

[x] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request

Current behavior
The definition tell us that it return an type <any>

Expected/desired behavior
The definition should return Observable<any>

Reproduction of the problem

  1. Creating a class who inherit of the TranslateHttpLoader
  2. using super.getTranslation

What is the motivation / use case for changing the behavior?
Does have to cast to get the right intellisense.

  • ngx-translate/http-loader version: 1.1.0

  • Angular version: 4.4.4

  • Browser: N/A

image

but should be

image

I am having a similar issue that I believe stems from the same thing.

Can't resolve all parameters for TranslateHttpLoader in 
            /node_modules/@ngx-translate/http-loader/src/http-loader.d.ts: ([object Object], ?, ?).

Have you found a solution for this?

@devdaddy You problem doesn't come from that, if more likely that you forgot to provider the HttpClient in the module that import ngx-translate.

Nope,

...

import { HttpClient, HttpClientModule } from "@angular/common/http";
import { TranslateModule, TranslateLoader } from "@ngx-translate/core";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";

...

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http);
}
@NgModule({

  ...

  imports: [
    BrowserModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    }),
  
...

Thoughts?

@devdaddy Sadly i have no idea.

@devdaddy you solved? I have the miss problem