ngx-translate / http-loader

A loader for ngx-translate that loads translations with http calls
MIT License
191 stars 69 forks source link

Error in http-loader.d.ts #35

Open Davilink opened 6 years ago

Davilink commented 6 years ago

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.

image

but should be

image

devdaddy commented 6 years ago

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?

Davilink commented 6 years ago

@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.

devdaddy commented 6 years ago

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?

Davilink commented 6 years ago

@devdaddy Sadly i have no idea.

ceaguilera commented 6 years ago

@devdaddy you solved? I have the miss problem