Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Class 'HttpClientBackendService' incorrectly implements interface 'HttpBackend'. #180

Closed
@IgorMinar

Description

@IgorMinar

When compiling angular.io examples after update to rxjs v6 I'm getting the following error:

node_modules/angular-in-memory-web-api/http-client-backend.service.d.ts(32,22): error TS2420: Class 'HttpClientBackendService' incorrectly implements interface 'HttpBackend'.
  Types of property 'handle' are incompatible.
    Type '(req: HttpRequest<any>) => Observable<HttpResponse<any>>' is not assignable to type '(req: HttpRequest<any>) => Observable<HttpEvent<any>>'.
      Type 'Observable<HttpResponse<any>>' is not assignable to type 'Observable<HttpEvent<any>>'.
        Property 'source' is protected but type 'Observable<T>' is not a class derived from 'Observable<T>'.

I haven't investigated why this error is surfaced only now, but it does seem that the interface is incorrectly implemented. See:

handle(req: HttpRequest<any>): Observable<HttpResponse<any>> {

Which returns an Observable<HttpResponse<any>> and not it's super class Observable<HttpEvent<any>>.

Found in version: 0.5.3

Workaround: disable typecheck of 3rd party code by setting "skipLibCheck": true in tsconfig.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions