troyanskiy / ngx-resource

Resource (REST) Client for Angular 2
http://troyanskiy.github.io/ngx-resource/
200 stars 46 forks source link

Generic ModuleWithProviders get an error #160

Closed RyuuGan closed 5 years ago

RyuuGan commented 5 years ago

After updating to Angular 9 RC the library @ngx-resource/handler-ngx-http can not be instantiated because of this error:

ERROR in ../node_modules/@ngx-resource/handler-ngx-http/lib/ResourceModule.d.ts:8:53 - error TS-996005: ResourceModule.forRoot returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.

     static forRoot(config?: IResourceModuleConfig): ModuleWithProviders;
RyuuGan commented 5 years ago

Update:

If you do without a shortcut method from @ngx-resource/handler-ngx-http ResourceModule.forRoot() it works.

import { ResourceModule, ResourceHandler } from '@ngx-resource/core';
import { ResourceHandlerHttpClient } from '@ngx-resource/handler-ngx-http';

...

ResourceModule.forRoot({
      handler: {
        provide: ResourceHandler,
        useClass: ResourceHandlerHttpClient,
        deps: [ HttpClient ]
      },
    }),
troyanskiy commented 5 years ago

Hello, Try to use libs with version 9.0.0 of which are with tag ‘next’

beradrian commented 4 years ago

I got the same issue after upgrading to Angular 10