0

So I have this class:

import { HttpRequest, HttpErrorResponse, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';

export declare class CommonHttpInterceptor implements HttpInterceptor {
  constructor();
  intercept(request: HttpRequest < any > , next: HttpHandler):
    Observable < HttpEvent < any >> ;
  protected _handleError(request: HttpRequest < any > ): (err: any) => void;
  protected _handleUnknownResponse(err: HttpErrorResponse, request: HttpRequest < any > ): void;
  protected _handleDefaultException(errorResponse: HttpErrorResponse): void;
  protected _handleInvalidResponse(errorResponse: HttpErrorResponse): void;
  protected _publishException(message: string, title ? : string): void;
}

And when I try to use it on another class I get a build error & WebStorm complains saying:

Incompatible override for member

import {Injectable} from '@angular/core';
import {CommonHttpInterceptor} from 'that class above';
import {HttpErrorResponse} from '@angular/common/http';

@Injectable()
export class positionDataHttpInterceptor extends CommonHttpInterceptor {

  constructor() {
    super();
  }

  protected _handleDefaultException(errorResponse: HttpErrorResponse): void {
    //some code
  }
}
  • they are both the same version of Angular.
LazyOne
  • 158,824
  • 45
  • 388
  • 391
Ed Diaz
  • 97
  • 1
  • 11

0 Answers0