Type 'Observable<Object>' is not assignable to type 'Observable<IUser[]>' : <p>In my Api service I have this simple <code>getUsers</code> function to fetch all of the users on the api.</p>

<pre><code>public getUsers(url: string): Observable&lt;IUser[]&gt;  {
  return this._http.get(url);
} 
</code></pre>

<p>This is my IUser interface, I have made all the field optional for now.</p>

<pre><code>export interface IUser {
  id?: string;
  first_name?: string;
  last_name?: string;
  location?: string;
  followers?: string;
  following?: string;
  checkins?: string;
  image?: string;
}
</code></pre>

<p>and here is how I have used the service in my component:</p>

<pre><code>export class SocialOverviewContainerComponent implements OnInit {
  public userData = [];
  public showForm = {};
  private _apiService: ApiService;

  constructor(apiService: ApiService) {
    this._apiService = apiService
  }

  public ngOnInit(): void {
    this.getUsersData();
  }

  public getUsersData()  {
    this._apiService.getUsers(ApiSettings.apiBasepath + 'users/')
      .subscribe(users =&gt; {
        this.userData = users;
    })
  }
}
</code></pre>

<p>and this is is the Type error I get when it compiles</p>

<pre><code>ERROR in src/app/services/api.service.ts(18,5): error TS2322: Type 'Observable&lt;Object&gt;' is not assignable to type 'Observable&lt;IUser[]&gt;'.
  Type 'Object' is not assignable to type 'IUser[]'.
    The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
      Property 'includes' is missing in type 'Object'.
</code></pre>

<p>I thought this might be because my response doesn't match the interface, which I have double check and it does. And I have also made the field optional for now to make sure.</p>

<p>I know I can fix this by casting the observable as any, but doesn't that defeat the point of using Typescript?</p>

<p>Any help on where I am going wrong would be great</p>

<p>Thanks in advance</p>
