Typescript: Type X is missing the following properties from type Y length, pop, push, concat, and 26 more.

Typescript: Type X is missing the following properties from type Y length, pop, push, concat, and 26 more.

I have Product interface:

I have Product interface:

export interface Product{
  code: string;
  description: string;
  type: string;
}

Service with method calling product endpoint:

  public getProducts(): Observable<Product> {
    return this.http.get<Product>(`api/products/v1/`);
  }

And component where I use this service to get the Products.

export class ShopComponent implements OnInit {
    public productsArray: Product[];

ngOnInit() {
    this.productService.getProducts().subscribe(res =&gt; {
      this.productsArray = res;
    });
}

}

With this state I'm getting error:

[ts] Type 'Product' is missing the following properties from type 'Product[]': length, pop, push, concat, and 26 more. [2740]

Removing typing on productsArray variable removes the error, but don't get why this is not working, since server response is an array of objects in the type of Products?

angular typescript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Basics of Angular: Part-1

What is Angular? What it does? How we implement it in a project? So, here are some basics of angular to let you learn more about angular. Angular is a Typesc

TypeScript, Angular, Firebase & Angular Material Master class Tutorial

As the course progresses, you'll get familiar with: TypeScript, Angular Application Architecture, and Angular CLI. Angular Modules and Angular Components. Angular's Component LifeCycle Hooks....

Angular Tutorial: Create a CRUD App with Angular CLI and TypeScript

Angular Tutorial: Create a CRUD App with Angular CLI and TypeScript. This tutorial gets you off the ground with Angular. We are going to use the official CLI (command line) tool to generate boilerplate code.

Angular: Novidades Angular v9 Ivy: TypeScript 3.7

Mais um vídeo da série sobre Angular v9 e Angular Ivy! Esse tutorial é uma dica rápida mostrando as duas maiores novidades to TypeScript 3.7 que é o operador de optional chaining e o operador de coalescência nula.

Data Table Pagination Using Angular Material

Explaining how to perform pagination of the data on the HTTP observable stream with the help of Angular Material