Error TS4053: Return type of public method from exported class has or is using name ‘Observable’
I only add this as an answer so it could help other SO users facing the same issue.
Just like @sudheer-kb mentioned, in order to solve that issue, you need to explicitly import the Observable
class:
import { Injectable } from '@angular/core';import { Http } from '@angular/http';// ...import { Observable } from "rxjs/Observable"; // <- add this import
And then give your method an explicit return type (also thanks @ruffin for your comment):
postLogin(data): Observable<any> { // ...}
I had a similar issue, it seems related to a problem with return types of methods. What worked for me is to simply add ": any" just after declaration of my methods, like this for example :
get(url) : any { //code}
I don't think it's a good habit, but it can be a good fix sometimes.