Skip to content

Argument of type 'Http' is not assignable to parameter of type 'Http' #11801

@kurapatijayaram

Description

@kurapatijayaram

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

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

class RESTClient {
   constructor(@Inject(Http) protected http: Http){
   }
   //Some code
}

@Injectable()
@BaseUrl("https://api.github.com/")
export class ReposService extends RESTClient{
  apiUrl: string = "https://api.github.com/";

  constructor(private _http: Http){
    super(_http)
  }

  @GET("orgs/angular/repos")
  list(){
    return null;
  }
}

Above code is throwing following error:

error TS2345: Argument of type 'Http' is not assignable to parameter of type 'Http'.
  Property '_backend' is protected but type 'Http' is not a class derived from 'Http'.

Expected behavior

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

macOS Sierra, atom, npm

  • Angular version: 2.0.0

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: TypeScript 1.8.10

  • Node (for AoT issues): node --version = 6.3.0

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